| 52 % | common\consts\BitSize.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class BitSize
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public const BITS_8 = 8;
17: public const BITS_16 = 16;
18: public const BITS_24 = 24;
19: public const BITS_32 = 32;
20: public const BITS_64 = 64;
21:
22: public const DEFAULT_INT_SIZE = PHP_INT_SIZE * 8;
23: public const DEFAULT_FLOAT_SIZE = self::BITS_64;
24:
25: /**
26: * @return int[]
27: */
28: public static function getIntSizes(): array
29: {
30: return [
31: self::BITS_8,
32: self::BITS_16,
33: self::BITS_24,
34: self::BITS_32,
35: self::BITS_64,
36: ];
37: }
38:
39: /**
40: * @return int[]
41: */
42: public static function getFloatSizes(): array
43: {
44: return [
45: self::BITS_32,
46: self::BITS_64,
47: ];
48: }
49:
50: /**
51: * @param int $size
52: * @throws \Dogma\InvalidSizeException
53: */
54: public static function checkIntSize(int $size): void
55: {
56: $sizes = self::getIntSizes();
57: if (!Arr::contains($sizes, $size)) {
58: throw new \Dogma\InvalidSizeException(Type::INT, $size, $sizes);
59: }
60: }
61:
62: /**
63: * @param int $size
64: * @throws \Dogma\InvalidSizeException
65: */
66: public static function checkFloatSize(int $size): void
67: {
68: $sizes = self::getFloatSizes();
69: if (!Arr::contains($sizes, $size)) {
70: throw new \Dogma\InvalidSizeException(Type::FLOAT, $size, $sizes);
71: }
72: }
73:
74: /**
75: * @param int $size
76: * @param string $sign
77: * @return int[]
78: */
79: public static function getIntRange(int $size, string $sign = Sign::SIGNED): array
80: {
81: $bounds = [
82: Sign::UNSIGNED => [
83: self::BITS_8 => [0, 255],
84: self::BITS_16 => [0, 65536],
85: self::BITS_24 => [0, 16777216],
86: self::BITS_32 => [0, 4294967296],
87: self::BITS_64 => [0, PHP_INT_MAX], // this is actually 63 bits, since PHP int is always signed
88: ],
89: Sign::SIGNED => [
90: self::BITS_8 => [-128, 127],
91: self::BITS_16 => [-32768, 32767],
92: self::BITS_24 => [-8388608, 8388607],
93: self::BITS_32 => [-2147483648, 2147483647],
94: self::BITS_64 => [PHP_INT_MIN, PHP_INT_MAX],
95: ],
96: ];
97:
98: return $bounds[$sign][$size];
99: }
100:
101: }
| 0 % | common\consts\CaseComparison.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class CaseComparison
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public const CASE_SENSITIVE = 0;
17: public const CASE_INSENSITIVE = SORT_FLAG_CASE; // 8
18:
19: }
| 0 % | common\consts\ComparisonResult.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class ComparisonResult
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public const GREATER = 1;
17: public const SAME = 0;
18: public const LESSER = -1;
19:
20: }
| 100 % | common\consts\Length.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class Length
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public const FIXED = 'fixed';
17:
18: }
| 0 % | common\consts\LineEnding.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class LineEnding
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public const LF = "\n";
17: public const CRLF = "\r\n";
18: public const CR = "\r";
19:
20: }
| 100 % | common\consts\Order.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class Order
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public const ASCENDING = SORT_ASC; // 4
17: public const DESCENDING = SORT_DESC; // 3
18:
19: }
| 0 % | common\consts\PowersOfTwo.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: final class PowersOfTwo
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public const _1 = 1; // 0
17: public const _2 = 2;
18: public const _4 = 4;
19: public const _8 = 8;
20: public const _16 = 16;
21: public const _32 = 32;
22: public const _64 = 64;
23: public const _128 = 128;
24: public const _256 = 256; // 8
25: public const _512 = 512;
26: public const _1K = 1024;
27: public const _2K = 2048;
28: public const _4K = 4096;
29: public const _8K = 8192;
30: public const _16K = 16384;
31: public const _32K = 32768;
32: public const _64K = 65536; // 16
33: public const _128K = 131072;
34: public const _256K = 262144;
35: public const _512K = 524288;
36: public const _1M = 1048576;
37: public const _2M = 2097152;
38: public const _4M = 4194304;
39: public const _8M = 8388608;
40: public const _16M = 16777216; // 24
41: public const _32M = 33554432;
42: public const _64M = 67108864;
43: public const _128M = 134217728;
44: public const _256M = 268435456;
45: public const _512M = 536870912;
46: public const _1G = 1073741824;
47: public const _2G = 2147483648;
48: public const _4G = 4294967296; // 32
49: public const _8G = 8589934592;
50: public const _16G = 17179869184;
51: public const _32G = 34359738368;
52: public const _64G = 68719476736;
53: public const _128G = 137438953472;
54: public const _256G = 274877906944;
55: public const _512G = 549755813888;
56: public const _1T = 1099511627776; // 40
57: public const _2T = 2199023255552;
58: public const _4T = 4398046511104;
59: public const _8T = 8796093022208;
60: public const _16T = 17592186044416;
61: public const _32T = 35184372088832;
62: public const _64T = 70368744177664;
63: public const _128T = 140737488355328;
64: public const _256T = 281474976710656; // 48
65: public const _512T = 562949953421312;
66: public const _1P = 1125899906842624;
67: public const _2P = 2251799813685248;
68: public const _4P = 4503599627370496;
69: public const _8P = 9007199254740992;
70: public const _16P = 18014398509481984;
71: public const _32P = 36028797018963968;
72: public const _64P = 72057594037927936; // 56
73: public const _128P = 144115188075855872;
74: public const _256P = 288230376151711744;
75: public const _512P = 576460752303423488;
76: public const _1E = 1152921504606846976;
77: public const _2E = 2305843009213693952;
78: public const _4E = 4611686018427387904; // 63
79:
80: }
| 0 % | common\consts\Round.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class Round
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public const NORMAL = 0;
17: public const UP = 1;
18: public const DOWN = 2;
19: public const TOWARDS_ZERO = 3;
20: public const AWAY_FROM_ZERO = 4;
21:
22: }
| 100 % | common\consts\Sign.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class Sign
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public const SIGNED = 'signed';
17: public const UNSIGNED = 'unsigned';
18:
19: public const POSITIVE = 1;
20: public const NEUTRAL = 0;
21: public const NEGATIVE = -1;
22:
23: }
| 100 % | common\consts\Sorting.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class Sorting
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public const REGULAR = SORT_REGULAR;
17: public const NUMERIC = SORT_NUMERIC;
18: public const STRING = SORT_STRING;
19: public const NATURAL = SORT_NATURAL;
20:
21: }
| 68 % | common\DogmaLoader.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: final class DogmaLoader
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var static */
17: private static $instance;
18:
19: /** @var string[] */
20: private $classMap = [];
21:
22: private function __construct()
23: {
24: $this->scan(__DIR__);
25: }
26:
27: public static function getInstance(): self
28: {
29: if (self::$instance === null) {
30: self::$instance = new self;
31: }
32: return self::$instance;
33: }
34:
35: public function register(bool $prepend = false): void
36: {
37: spl_autoload_register([$this, 'tryLoad'], true, $prepend);
38: }
39:
40: public function tryLoad(string $class): void
41: {
42: $class = ltrim($class, '\\');
43: if (isset($this->classMap[$class])) {
44: require $this->classMap[$class];
45: return;
46: }
47:
48: if (substr($class, 0, 6) !== 'Dogma\\') {
49: return;
50: }
51:
52: $file = dirname(__DIR__) . DIRECTORY_SEPARATOR . strtr(substr($class, 5), '\\', DIRECTORY_SEPARATOR) . '.php';
53: if (is_file($file)) {
54: require $file;
55: return;
56: }
57:
58: if (substr($class, -9) === 'Exception') {
59: $parts = explode('\\', substr($class, 5));
60: $last = array_pop($parts);
61: $parts[] = 'exceptions';
62: $parts[] = $last;
63: $file = dirname(__DIR__) . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $parts) . '.php';
64: if (is_file($file)) {
65: require $file;
66: return;
67: }
68: }
69: }
70:
71: /**
72: * @return string[]
73: */
74: public function getClassMap(): array
75: {
76: return $this->classMap;
77: }
78:
79: private function scan(string $dir): void
80: {
81: foreach (glob($dir . '\\*') as $path) {
82: if (is_dir($path)) {
83: $this->scan($path);
84: } elseif (is_file($path)) {
85: $parts = explode(DIRECTORY_SEPARATOR, str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path));
86: $file = array_pop($parts);
87: $class = substr($file, 0, -4);
88: $this->classMap[sprintf('Dogma\\%s', $class)] = $path;
89: }
90: }
91: }
92:
93: }
| 100 % | common\exceptions\Exception.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class Exception extends \Exception
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: public function __construct(string $message, ?\Throwable $previous = null)
17: {
18: parent::__construct($message, 0, $previous);
19: }
20:
21: }
| 100 % | common\exceptions\ExceptionTypeFormatter.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class ExceptionTypeFormatter
13: {
14: use \Dogma\StaticClassMixin;
15:
16: /**
17: * @param mixed $type
18: * @return string
19: */
20: public static function format($type): string
21: {
22: if (is_array($type)) {
23: return implode(' or ', array_map([self::class, 'formatType'], $type));
24: } else {
25: return self::formatType($type);
26: }
27: }
28:
29: /**
30: * @param mixed $type
31: * @return string
32: */
33: private static function formatType($type): string
34: {
35: if ($type instanceof Type) {
36: return $type->getId();
37: } elseif (is_object($type)) {
38: return get_class($type);
39: } elseif (is_resource($type)) {
40: return sprintf('resource(%s)', get_resource_type($type));
41: } elseif (is_string($type)) {
42: return $type;
43: } else {
44: return gettype($type);
45: }
46: }
47:
48: }
| 71 % | common\exceptions\ExceptionValueFormatter.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class ExceptionValueFormatter
13: {
14: use \Dogma\StaticClassMixin;
15:
16: /**
17: * @param mixed $value
18: * @return string
19: */
20: public static function format($value): string
21: {
22: if (is_object($value)) {
23: return sprintf('%s #%s', get_class($value), substr(md5(spl_object_hash($value)), 0, 8));
24: } elseif (is_resource($value)) {
25: return sprintf('resource (%s) #%d', get_resource_type($value), substr($value, 13));
26: } elseif (is_array($value)) {
27: return sprintf('array (%d) #%s', count($value), substr(md5(serialize($value)), 0, 8));
28: } elseif (is_string($value)) {
29: return sprintf('"%s" (%d)', $value, strlen($value));
30: } elseif (is_bool($value)) {
31: return $value ? 'TRUE' : 'FALSE';
32: } elseif (is_null($value)) {
33: return 'NULL';
34: } else { // integer, float
35: return (string) $value;
36: }
37: }
38:
39: }
| 0 % | common\exceptions\LogicException.php |
<?php
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: final class LogicException extends \Dogma\Exception
13: {
14:
15: }
| 0 % | common\exceptions\NotImplementedException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class NotImplementedException extends \Dogma\Exception
13: {
14:
15: }
| 0 % | common\exceptions\ShouldNotHappenException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: final class ShouldNotHappenException extends \Dogma\Exception
13: {
14:
15: }
| 100 % | common\interfaces\Comparable.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma;
4:
5: interface Comparable
6: {
7:
8: /**
9: * @param \Dogma\Comparable $other
10: * @return int @see \Dogma\ComparisonResult
11: */
12: public function compare(self $other): int;
13:
14: }
| 100 % | common\interfaces\Equalable.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma;
4:
5: interface Equalable
6: {
7:
8: public function equals(self $other): bool;
9:
10: }
| 100 % | common\iterators\ArrayIterator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class ArrayIterator implements \Iterator
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var mixed[] */
17: private $array;
18:
19: /**
20: * @param mixed[] $array
21: */
22: public function __construct(array $array)
23: {
24: $this->array = $array;
25: }
26:
27: public function rewind(): void
28: {
29: reset($this->array);
30: }
31:
32: public function next(): void
33: {
34: next($this->array);
35: }
36:
37: public function valid(): bool
38: {
39: return key($this->array) !== null;
40: }
41:
42: /**
43: * @return int|string
44: */
45: public function key()
46: {
47: return key($this->array);
48: }
49:
50: /**
51: * @return mixed
52: */
53: public function current()
54: {
55: return current($this->array);
56: }
57:
58: }
| 100 % | common\iterators\CallbackIterator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class CallbackIterator extends \IteratorIterator
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var callable */
17: private $callback;
18:
19: public function __construct(iterable $iterable, callable $callback)
20: {
21: $this->callback = $callback;
22:
23: $iterable = IteratorHelper::iterableToIterator($iterable);
24:
25: parent::__construct($iterable);
26: }
27:
28: /**
29: * @return mixed
30: */
31: public function current()
32: {
33: $current = parent::current();
34:
35: return call_user_func($this->callback, $current);
36: }
37:
38: }
| 100 % | common\iterators\ChunkIterator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class ChunkIterator extends \IteratorIterator
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var int */
17: private $chunkSize;
18:
19: /** @var int */
20: private $key;
21:
22: /** @var mixed[] */
23: private $chunk;
24:
25: /**
26: * @param iterable $iterable
27: * @param int $chunkSize
28: */
29: public function __construct(iterable $iterable, int $chunkSize)
30: {
31: Check::positive($chunkSize);
32: $iterable = IteratorHelper::iterableToIterator($iterable);
33:
34: $this->chunkSize = $chunkSize;
35:
36: parent::__construct($iterable);
37: }
38:
39: public function rewind(): void
40: {
41: parent::rewind();
42:
43: $this->next();
44: $this->key = 0;
45: }
46:
47: public function next(): void
48: {
49: $this->chunk = [];
50: for ($i = 0; $i < $this->chunkSize && parent::valid(); $i++) {
51: $this->chunk[] = parent::current();
52: parent::next();
53: }
54: $this->key++;
55: }
56:
57: /**
58: * @return mixed[]
59: */
60: public function current(): array
61: {
62: return $this->chunk;
63: }
64:
65: public function key(): int
66: {
67: return $this->key;
68: }
69:
70: public function valid(): bool
71: {
72: return (bool) $this->chunk;
73: }
74:
75: }
| 100 % | common\iterators\CombineIterator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class CombineIterator implements \Iterator
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var \Iterator */
17: private $keys;
18:
19: /** @var \Iterator */
20: private $values;
21:
22: public function __construct(iterable $keys, iterable $values)
23: {
24: $this->keys = IteratorHelper::iterableToIterator($keys);
25: $this->values = IteratorHelper::iterableToIterator($values);
26: }
27:
28: public function rewind(): void
29: {
30: $this->keys->rewind();
31: $this->values->rewind();
32: }
33:
34: public function next(): void
35: {
36: $this->keys->next();
37: $this->values->next();
38: }
39:
40: public function valid(): bool
41: {
42: return $this->keys->valid() && $this->values->valid();
43: }
44:
45: /**
46: * @return mixed|null
47: */
48: public function current()
49: {
50: return $this->values->valid() ? $this->values->current() : null;
51: }
52:
53: /**
54: * @return int|string|null
55: */
56: public function key()
57: {
58: return $this->keys->valid() ? $this->keys->current() : null;
59: }
60:
61: }
| 100 % | common\iterators\FetchKeysIterator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class FetchKeysIterator extends \IteratorIterator
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var int|string */
17: private $keysKey;
18:
19: /** @var int|string */
20: private $valuesKey;
21:
22: /**
23: * @param iterable $iterable
24: * @param string|null $keysKey
25: * @param string|null $valuesKey
26: */
27: public function __construct(iterable $iterable, ?string $keysKey = null, ?string $valuesKey = null)
28: {
29: $iterable = IteratorHelper::iterableToIterator($iterable);
30:
31: parent::__construct($iterable);
32:
33: $this->keysKey = $keysKey;
34: $this->valuesKey = $valuesKey;
35: }
36:
37: /**
38: * @return mixed
39: */
40: public function current()
41: {
42: if ($this->valuesKey === null) {
43: return parent::current();
44: } else {
45: $value = parent::current();
46: if (!is_array($value) && !$value instanceof \ArrayAccess) {
47: throw new \Dogma\InvalidTypeException('array or ArrayAccess', $value);
48: }
49: return $value[$this->valuesKey];
50: }
51: }
52:
53: /**
54: * @return string|int
55: */
56: public function key()
57: {
58: if ($this->keysKey === null) {
59: return parent::key();
60: } else {
61: $value = parent::current();
62: if (!is_array($value) && !$value instanceof \ArrayAccess) {
63: throw new \Dogma\InvalidTypeException('array or ArrayAccess', $value);
64: }
65: return $value[$this->keysKey];
66: }
67: }
68:
69: }
| 67 % | common\iterators\IteratorHelper.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class IteratorHelper
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public static function iterableToIterator(iterable $iterable): \Iterator
17: {
18: if (is_array($iterable)) {
19: return new ArrayIterator($iterable);
20: } elseif ($iterable instanceof \Iterator) {
21: return $iterable;
22: }
23: while ($iterable instanceof \IteratorAggregate) {
24: /** @var \Iterator $iterable */
25: $iterable = $iterable->getIterator();
26: }
27: return $iterable;
28: }
29:
30: }
| 100 % | common\iterators\ReverseArrayIterator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class ReverseArrayIterator implements \Iterator
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var mixed[] */
17: private $array;
18:
19: /**
20: * @param mixed[] $array
21: */
22: public function __construct(array $array)
23: {
24: $this->array = $array;
25: }
26:
27: public function rewind(): void
28: {
29: end($this->array);
30: }
31:
32: public function next(): void
33: {
34: prev($this->array);
35: }
36:
37: public function valid(): bool
38: {
39: return key($this->array) !== null;
40: }
41:
42: /**
43: * @return int|string
44: */
45: public function key()
46: {
47: return key($this->array);
48: }
49:
50: /**
51: * @return mixed
52: */
53: public function current()
54: {
55: return current($this->array);
56: }
57:
58: }
| 99 % | common\lists\Arr.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class Arr
13: {
14: use \Dogma\StaticClassMixin;
15:
16: /** @internal */
17: private const PRESERVE_KEYS = true;
18:
19: /**
20: * @param mixed[] $keys
21: * @param mixed[] $values
22: * @return mixed[]
23: */
24: public static function combine(array $keys, array $values): array
25: {
26: return array_combine($keys, $values);
27: }
28:
29: /**
30: * @param iterable $that
31: * @return mixed[]
32: */
33: public static function toArray(iterable $that): array
34: {
35: if (is_array($that)) {
36: return $that;
37: } elseif ($that instanceof ImmutableArray) {
38: return $that->toArray();
39: } elseif ($that instanceof \Traversable) {
40: return iterator_to_array($that);
41: } else {
42: throw new \Dogma\InvalidTypeException(Type::PHP_ARRAY, $that);
43: }
44: }
45:
46: /**
47: * @param mixed[] $array
48: * @return \Dogma\ArrayIterator
49: */
50: public static function iterate(array $array): ArrayIterator
51: {
52: return new ArrayIterator($array);
53: }
54:
55: /**
56: * @param mixed[] $array
57: * @return \Dogma\ReverseArrayIterator
58: */
59: public static function backwards(array $array): ReverseArrayIterator
60: {
61: return new ReverseArrayIterator($array);
62: }
63:
64: /**
65: * @param int|string $start
66: * @param int|string $end
67: * @param int $step >= 1
68: * @return mixed[]
69: */
70: public static function range($start, $end, int $step = 1): array
71: {
72: Check::min($step, 1);
73:
74: return range($start, $end, $step);
75: }
76:
77: /**
78: * @param mixed[] $array
79: * @return mixed[]
80: */
81: public static function keys(array $array): array
82: {
83: return array_keys($array);
84: }
85:
86: /**
87: * @param mixed[] $array
88: * @return mixed[]
89: */
90: public static function values(array $array): array
91: {
92: return array_values($array);
93: }
94:
95: /**
96: * @param mixed[] $array
97: * @return mixed
98: */
99: public static function randomKey(array $array)
100: {
101: return array_rand($array);
102: }
103:
104: /**
105: * @param mixed[] $array
106: * @return mixed
107: */
108: public static function randomValue(array $array)
109: {
110: return $array[array_rand($array)];
111: }
112:
113: /**
114: * @param mixed[] $array
115: * @param callable $function
116: */
117: public static function doForEach(array $array, callable $function): void
118: {
119: foreach ($array as $value) {
120: $function($value);
121: }
122: }
123:
124: // queries ---------------------------------------------------------------------------------------------------------
125:
126: /**
127: * @param mixed[] $array
128: * @return bool
129: */
130: public static function isEmpty(array $array): bool
131: {
132: return empty($array);
133: }
134:
135: /**
136: * @param mixed[] $array
137: * @return bool
138: */
139: public static function isNotEmpty(array $array): bool
140: {
141: return !empty($array);
142: }
143:
144: /**
145: * @param mixed[] $array
146: * @param mixed $value
147: * @return bool
148: */
149: public static function contains(array $array, $value): bool
150: {
151: return array_search($value, $array, Type::STRICT) !== false;
152: }
153:
154: /**
155: * @param mixed[] $array
156: * @param mixed $value
157: * @param int $from
158: * @return int|string|null
159: */
160: public static function indexOf(array $array, $value, int $from = 0)
161: {
162: if ($from > 0) {
163: return self::indexOf(self::drop($array, $from), $value);
164: }
165: $result = array_search($value, $array, Type::STRICT);
166:
167: return $result === false ? null : $result;
168: }
169:
170: /**
171: * @param mixed[] $array
172: * @param mixed $value
173: * @return int[]|string[]
174: */
175: public static function indexesOf(array $array, $value): array
176: {
177: return array_keys($array, $value, Type::STRICT);
178: }
179:
180: /**
181: * @param mixed[] $array
182: * @param mixed $value
183: * @param int $end
184: * @return int|string|null
185: */
186: public static function lastIndexOf(array $array, $value, $end = null)
187: {
188: if ($end !== null) {
189: return self::last(self::indexesOf(self::take($array, $end), $value));
190: }
191: return self::last(self::indexesOf($array, $value));
192: }
193:
194: /**
195: * @param mixed[] $array
196: * @param callable $function
197: * @param int $from
198: * @return int|string|null
199: */
200: public static function indexWhere(array $array, callable $function, int $from = 0)
201: {
202: foreach (self::drop($array, $from) as $key => $value) {
203: if ($function($value)) {
204: return $key;
205: }
206: }
207: return null;
208: }
209:
210: /**
211: * @param mixed[] $array
212: * @param callable $function
213: * @param int $end
214: * @return int|string|null
215: */
216: public static function lastIndexWhere(array $array, callable $function, ?int $end = null)
217: {
218: return self::indexWhere(self::reverse(self::take($array, $end)), $function);
219: }
220:
221: /**
222: * @param mixed[] $array
223: * @param mixed $key
224: * @return bool
225: */
226: public static function containsKey(array $array, $key): bool
227: {
228: return array_key_exists($key, $array);
229: }
230:
231: /**
232: * @param mixed[] $array
233: * @param callable $function
234: * @return bool
235: */
236: public static function exists(array $array, callable $function): bool
237: {
238: foreach ($array as $value) {
239: if ($function($value)) {
240: return true;
241: }
242: }
243: return false;
244: }
245:
246: /**
247: * @param mixed[] $array
248: * @param callable $function
249: * @return bool
250: */
251: public static function forAll(array $array, callable $function): bool
252: {
253: foreach ($array as $value) {
254: if (!$function($value)) {
255: return false;
256: }
257: }
258: return true;
259: }
260:
261: /**
262: * @param mixed[] $array
263: * @param callable $function
264: * @return mixed|null
265: */
266: public static function find(array $array, callable $function)
267: {
268: foreach ($array as $value) {
269: if ($function($value)) {
270: return $value;
271: }
272: }
273: return null;
274: }
275:
276: /**
277: * @param mixed[] $array
278: * @param callable $function
279: * @return int
280: */
281: public static function prefixLength(array $array, callable $function): int
282: {
283: return self::segmentLength($array, $function, 0);
284: }
285:
286: /**
287: * @param mixed[] $array
288: * @param callable $function
289: * @param int $from
290: * @return int
291: */
292: public static function segmentLength(array $array, callable $function, int $from = 0): int
293: {
294: $i = 0;
295: foreach (self::drop($array, $from) as $value) {
296: if (!$function($value)) {
297: break;
298: }
299: $i++;
300: }
301: return $i;
302: }
303:
304: // stats -----------------------------------------------------------------------------------------------------------
305:
306: /**
307: * @param mixed[] $array
308: * @param callable $function
309: * @return int
310: */
311: public static function count(array $array, ?callable $function = null): int
312: {
313: if ($function === null) {
314: return count($array);
315: }
316: $count = 0;
317: foreach ($array as $value) {
318: if ($function($value)) {
319: $count++;
320: }
321: }
322: return $count;
323: }
324:
325: /**
326: * Alias of count() without params
327: * @param mixed[] $array
328: * @return int
329: */
330: public static function size(array $array): int
331: {
332: return count($array);
333: }
334:
335: /**
336: * @param mixed[] $array
337: * @return int[]|string[]
338: */
339: public static function countValues(array $array): array
340: {
341: return array_count_values($array);
342: }
343:
344: /**
345: * @param mixed[] $array
346: * @return mixed|null
347: */
348: public static function max(array $array)
349: {
350: if (empty($array)) {
351: return null;
352: }
353: return max($array);
354: }
355:
356: /**
357: * @param mixed[] $array
358: * @return mixed|null
359: */
360: public static function min(array $array)
361: {
362: if (empty($array)) {
363: return null;
364: }
365: return min($array);
366: }
367:
368: /**
369: * @param mixed[] $array
370: * @param callable $function
371: * @return mixed|null
372: */
373: public static function maxBy(array $array, callable $function)
374: {
375: if (empty($array)) {
376: return null;
377: }
378: $max = self::max(self::map($array, $function));
379: return self::find($array, function ($value) use ($max, $function) {
380: return $function($value) === $max;
381: });
382: }
383:
384: /**
385: * @param mixed[] $array
386: * @param callable $function
387: * @return mixed|null
388: */
389: public static function minBy(array $array, callable $function)
390: {
391: if (empty($array)) {
392: return null;
393: }
394: $min = self::min(self::map($array, $function));
395: return self::find($array, function ($value) use ($min, $function) {
396: return $function($value) === $min;
397: });
398: }
399:
400: /**
401: * @param mixed[] $array
402: * @return int|float
403: */
404: public static function product(array $array)
405: {
406: return array_product($array);
407: }
408:
409: /**
410: * @param mixed[] $array
411: * @return int|float
412: */
413: public static function sum(array $array)
414: {
415: return array_sum($array);
416: }
417:
418: // comparison ------------------------------------------------------------------------------------------------------
419:
420: /**
421: * @param mixed[] $array
422: * @param mixed[] $slice
423: * @return bool
424: */
425: public static function containsSlice(array $array, array $slice): bool
426: {
427: return self::indexOfSlice($array, $slice, 0) !== null;
428: }
429:
430: /**
431: * @param mixed[] $array
432: * @param mixed[] $slice
433: * @param int $from
434: * @return int|null
435: */
436: public static function indexOfSlice(array $array, array $slice, int $from = 0): ?int
437: {
438: $that = self::drop($array, $from);
439: while (!empty($that)) {
440: if (self::startsWith($that, $slice)) {
441: return $from;
442: }
443: $from++;
444: $that = self::tail($that);
445: }
446:
447: return null;
448: }
449:
450: /**
451: * @param mixed[] $array
452: * @param mixed[] $other
453: * @param callable $function
454: * @return bool
455: */
456: public static function corresponds(array $array, array $other, callable $function): bool
457: {
458: if (count($array) !== count($other)) {
459: return false;
460: }
461: $iterator = new ArrayIterator($array);
462: $iterator->rewind();
463: foreach ($other as $value) {
464: if (!$iterator->valid() || !$function($iterator->current(), $value)) {
465: return false;
466: }
467: $iterator->next();
468: }
469: return true;
470: }
471:
472: /**
473: * @param mixed[] $array
474: * @param mixed[] $other
475: * @return bool
476: */
477: public static function hasSameElements(array $array, array $other): bool
478: {
479: return self::corresponds($array, $other, function ($a, $b) {
480: return $a === $b;
481: });
482: }
483:
484: /**
485: * @param mixed[] $array
486: * @param mixed[] $slice
487: * @param int $from
488: * @return bool
489: */
490: public static function startsWith(array $array, array $slice, int $from = 0): bool
491: {
492: $iterator = new ArrayIterator(self::drop($array, $from));
493: $iterator->rewind();
494: foreach ($slice as $value) {
495: if ($iterator->valid() && $value === $iterator->current()) {
496: $iterator->next();
497: } else {
498: return false;
499: }
500: }
501: return true;
502: }
503:
504: /**
505: * @param mixed[] $array
506: * @param mixed[] $slice
507: * @return bool
508: */
509: public static function endsWith(array $array, array $slice): bool
510: {
511: return self::startsWith($array, $slice, count($array) - count($slice));
512: }
513:
514: // transforming ----------------------------------------------------------------------------------------------------
515:
516: /**
517: * @param mixed[] $array
518: * @param callable $function
519: * @param mixed|null $init
520: * @return mixed|null
521: */
522: public static function fold(array $array, callable $function, $init = null)
523: {
524: return self::foldLeft($array, $function, $init);
525: }
526:
527: /**
528: * @param mixed[] $array
529: * @param callable $function
530: * @param mixed|null $init
531: * @return mixed|null
532: */
533: public static function foldLeft(array $array, callable $function, $init = null)
534: {
535: return array_reduce($array, $function, $init);
536: }
537:
538: /**
539: * @param mixed[] $array
540: * @param callable $function
541: * @param mixed|null $init
542: * @return mixed|null
543: */
544: public static function foldRight(array $array, callable $function, $init = null)
545: {
546: foreach (new ReverseArrayIterator($array) as $value) {
547: $init = $function($value, $init);
548: }
549: return $init;
550: }
551:
552: /**
553: * @param mixed[] $array
554: * @param callable $function
555: * @return mixed|null
556: */
557: public static function reduce(array $array, callable $function)
558: {
559: return self::reduceLeft($array, $function);
560: }
561:
562: /**
563: * @param mixed[] $array
564: * @param callable $function
565: * @return mixed|null
566: */
567: public static function reduceLeft(array $array, callable $function)
568: {
569: if (empty($array)) {
570: return null;
571: }
572: return self::foldLeft(self::tail($array), $function, self::head($array));
573: }
574:
575: /**
576: * @param mixed[] $array
577: * @param callable $function
578: * @return mixed|null
579: */
580: public static function reduceRight(array $array, callable $function)
581: {
582: if (empty($array)) {
583: return null;
584: }
585: return self::foldRight(self::init($array), $function, self::last($array));
586: }
587:
588: /**
589: * @param mixed[] $array
590: * @param callable $function
591: * @param mixed $init
592: * @return mixed[]
593: */
594: public static function scanLeft(array $array, callable $function, $init): array
595: {
596: $res = [];
597: $res[] = $init;
598: foreach ($array as $value) {
599: $res[] = $init = $function($init, $value);
600: }
601: return $res;
602: }
603:
604: /**
605: * @param mixed[] $array
606: * @param callable $function
607: * @param mixed $init
608: * @return mixed[]
609: */
610: public static function scanRight(array $array, callable $function, $init): array
611: {
612: $res = [];
613: $res[] = $init;
614: foreach (new ReverseArrayIterator($array) as $value) {
615: $init = $function($value, $init);
616: array_unshift($res, $init);
617: }
618: return $res;
619: }
620:
621: // slicing ---------------------------------------------------------------------------------------------------------
622:
623: /**
624: * @param mixed[] $array
625: * @return mixed|null
626: */
627: public static function head(array $array)
628: {
629: if (count($array) === 0) {
630: return null;
631: }
632: return reset($array);
633: }
634:
635: /**
636: * Alias of head()
637: * @param mixed[] $array
638: * @return mixed|null
639: */
640: public static function first(array $array)
641: {
642: if (count($array) === 0) {
643: return null;
644: }
645: return reset($array);
646: }
647:
648: /**
649: * @param mixed[] $array
650: * @return mixed|null
651: */
652: public static function last(array $array)
653: {
654: if (count($array) === 0) {
655: return null;
656: }
657: return end($array);
658: }
659:
660: /**
661: * @param mixed[] $array
662: * @return mixed[]
663: */
664: public static function init(array $array): array
665: {
666: return self::slice($array, 0, -1);
667: }
668:
669: /**
670: * @param mixed[] $array
671: * @return mixed[]
672: */
673: public static function tail(array $array): array
674: {
675: return self::drop($array, 1);
676: }
677:
678: /**
679: * @param mixed[] $array
680: * @return mixed[]
681: */
682: public static function inits(array $array): array
683: {
684: $res = [$array];
685: $that = $array;
686: while (!empty($that)) {
687: $res[] = $that = self::init($that);
688: }
689: return $res;
690: }
691:
692: /**
693: * @param mixed[] $array
694: * @return mixed[]
695: */
696: public static function tails(array $array): array
697: {
698: $res = [$array];
699: $that = $array;
700: while (!empty($that)) {
701: $res[] = $that = self::tail($that);
702: }
703: return $res;
704: }
705:
706: /**
707: * @param mixed[] $array
708: * @return mixed[] (mixed $head, static $tail)
709: */
710: public static function headTail(array $array): array
711: {
712: return [self::head($array), self::tail($array)];
713: }
714:
715: /**
716: * @param mixed[] $array
717: * @return mixed[] (static $init, mixed $last)
718: */
719: public static function initLast(array $array): array
720: {
721: return [self::init($array), self::last($array)];
722: }
723:
724: /**
725: * @param mixed[] $array
726: * @param int $from
727: * @param int $length
728: * @return mixed[]
729: */
730: public static function slice(array $array, int $from, ?int $length = null): array
731: {
732: return array_slice($array, $from, $length, self::PRESERVE_KEYS);
733: }
734:
735: /**
736: * @param mixed[] $array
737: * @param int $size
738: * @return mixed[]
739: */
740: public static function chunks(array $array, int $size): array
741: {
742: return array_chunk($array, $size, self::PRESERVE_KEYS);
743: }
744:
745: /**
746: * @param mixed[] $array
747: * @param int $size
748: * @param int $step
749: * @return mixed[]
750: */
751: public static function sliding(array $array, int $size, int $step = 1): array
752: {
753: $res = [];
754: for ($i = 0; $i <= count($array) - $size + $step - 1; $i += $step) {
755: $res[] = self::slice($array, $i, $size);
756: }
757: return $res;
758: }
759:
760: /**
761: * @param mixed[] $array
762: * @param int $count
763: * @return mixed[]
764: */
765: public static function drop(array $array, int $count): array
766: {
767: return self::slice($array, $count, count($array));
768: }
769:
770: /**
771: * @param mixed[] $array
772: * @param int $count
773: * @return mixed[]
774: */
775: public static function dropRight(array $array, int $count): array
776: {
777: return self::slice($array, 0, count($array) - $count);
778: }
779:
780: /**
781: * @param mixed[] $array
782: * @param callable $function
783: * @return mixed[]
784: */
785: public static function dropWhile(array $array, callable $function): array
786: {
787: $res = [];
788: $go = false;
789: foreach ($array as $key => $value) {
790: if (!$function($value)) {
791: $go = true;
792: }
793: if ($go) {
794: $res[$key] = $value;
795: }
796: }
797: return $res;
798: }
799:
800: /**
801: * @param mixed[] $array
802: * @param int $length
803: * @param mixed $value
804: * @return mixed[]
805: */
806: public static function padTo(array $array, int $length, $value): array
807: {
808: return array_pad($array, $length, $value);
809: }
810:
811: /**
812: * @param mixed[] $array
813: * @param callable $function
814: * @return mixed[][] (static $l, static $r)
815: */
816: public static function span(array $array, callable $function): array
817: {
818: $l = [];
819: $r = [];
820: $toLeft = true;
821: foreach ($array as $key => $value) {
822: $toLeft = $toLeft && $function($value);
823: if ($toLeft) {
824: $l[$key] = $value;
825: } else {
826: $r[$key] = $value;
827: }
828: }
829: return [$l, $r];
830: }
831:
832: /**
833: * @param mixed[] $array
834: * @param int|null $count
835: * @return mixed[]
836: */
837: public static function take(array $array, ?int $count = null): array
838: {
839: return self::slice($array, 0, $count);
840: }
841:
842: /**
843: * @param mixed[] $array
844: * @param int $count
845: * @return mixed[]
846: */
847: public static function takeRight(array $array, int $count): array
848: {
849: return self::slice($array, -$count, $count);
850: }
851:
852: /**
853: * @param mixed[] $array
854: * @param callable $function
855: * @return mixed[]
856: */
857: public static function takeWhile(array $array, callable $function): array
858: {
859: $res = [];
860: foreach ($array as $key => $value) {
861: if (!$function($value)) {
862: break;
863: }
864: $res[$key] = $value;
865: }
866: return $res;
867: }
868:
869: // filtering -------------------------------------------------------------------------------------------------------
870:
871: /**
872: * @param mixed[] $array
873: * @param callable $function
874: * @return mixed[]
875: */
876: public static function collect(array $array, callable $function): array
877: {
878: return self::filter(self::map($array, $function));
879: }
880:
881: /**
882: * @param mixed[] $array
883: * @param callable $function
884: * @return mixed[]
885: */
886: public static function filter(array $array, ?callable $function = null): array
887: {
888: if ($function) {
889: return array_filter($array, $function);
890: } else {
891: return array_filter($array);
892: }
893: }
894:
895: /**
896: * @param mixed[] $array
897: * @param callable $function
898: * @return mixed[]
899: */
900: public static function filterKeys(array $array, callable $function): array
901: {
902: $res = [];
903: foreach ($array as $key => $value) {
904: if ($function($key)) {
905: $res[$key] = $value;
906: }
907: }
908: return $res;
909: }
910:
911: /**
912: * @param mixed[] $array
913: * @param callable $function
914: * @return mixed[]
915: */
916: public static function filterNot(array $array, callable $function): array
917: {
918: return self::filter($array, function ($value) use ($function) {
919: return !$function($value);
920: });
921: }
922:
923: /**
924: * @param mixed[] $array
925: * @param callable $function
926: * @return mixed[][] (mixed[] $fist, mixed[] $second)
927: */
928: public static function partition(array $array, callable $function): array
929: {
930: $a = [];
931: $b = [];
932: foreach ($array as $key => $value) {
933: if ($function($value)) {
934: $a[$key] = $value;
935: } else {
936: $b[$key] = $value;
937: }
938: }
939: return [$a, $b];
940: }
941:
942: // mapping ---------------------------------------------------------------------------------------------------------
943:
944: /**
945: * @param mixed[] $array
946: * @param callable $function
947: * @return mixed[]
948: */
949: public static function flatMap(array $array, callable $function): array
950: {
951: return self::flatten(self::map($array, $function));
952: }
953:
954: /**
955: * @param mixed[] $array
956: * @return mixed[]
957: */
958: public static function flatten(array $array): array
959: {
960: $res = [];
961: foreach ($array as $values) {
962: if (is_array($values)) {
963: foreach (self::flatten($values) as $value) {
964: $res[] = $value;
965: }
966: } else {
967: $res[] = $values;
968: }
969: }
970: return $res;
971: }
972:
973: /**
974: * @param mixed[] $array
975: * @param callable $function
976: * @return mixed[]
977: */
978: public static function groupBy(array $array, callable $function): array
979: {
980: $res = [];
981: foreach ($array as $key => $value) {
982: $groupKey = $function($value);
983: $res[$groupKey][$key] = $value;
984: }
985: return $res;
986: }
987:
988: /**
989: * @param mixed[] $array
990: * @param callable $function
991: * @return mixed[]
992: */
993: public static function map(array $array, callable $function): array
994: {
995: return array_map($function, $array);
996: }
997:
998: /**
999: * @param mixed[] $array
1000: * @param callable $function
1001: * @return mixed[]
1002: */
1003: public static function mapPairs(array $array, callable $function): array
1004: {
1005: return self::remap($array, function ($key, $value) use ($function) {
1006: return [$key => $function($key, $value)];
1007: });
1008: }
1009:
1010: /**
1011: * @param mixed[] $array
1012: * @param callable $function
1013: * @return mixed[]
1014: */
1015: public static function remap(array $array, callable $function): array
1016: {
1017: $res = [];
1018: foreach ($array as $key => $value) {
1019: foreach ($function($key, $value) as $newKey => $newValue) {
1020: $res[$newKey] = $newValue;
1021: }
1022: }
1023: return $res;
1024: }
1025:
1026: /**
1027: * @param mixed[] $array
1028: * @return mixed[]
1029: */
1030: public static function flip(array $array): array
1031: {
1032: return array_flip($array);
1033: }
1034:
1035: /**
1036: * @param mixed[] $array
1037: * @return mixed[]
1038: */
1039: public static function transpose(array $array): array
1040: {
1041: if (empty($array)) {
1042: return [];
1043: }
1044: array_unshift($array, null);
1045: $array = array_map(...$array);
1046: foreach ($array as $key => $value) {
1047: $array[$key] = (array) $value;
1048: }
1049: return $array;
1050: }
1051:
1052: /**
1053: * @param mixed[][] $array
1054: * @param mixed $valueKey
1055: * @param mixed|null $indexKey
1056: * @return mixed[]
1057: */
1058: public static function column(array $array, $valueKey, $indexKey = null): array
1059: {
1060: return array_column($array, $valueKey, $indexKey);
1061: }
1062:
1063: // sorting ---------------------------------------------------------------------------------------------------------
1064:
1065: /**
1066: * @param mixed[] $array
1067: * @return mixed[]
1068: */
1069: public static function reverse(array $array): array
1070: {
1071: return array_reverse($array, self::PRESERVE_KEYS);
1072: }
1073:
1074: /**
1075: * @param mixed[] $array
1076: * @return mixed[]
1077: */
1078: public static function shuffle(array $array): array
1079: {
1080: $arr = $array;
1081: shuffle($arr);
1082: return $arr;
1083: }
1084:
1085: /**
1086: * @param mixed[] $array
1087: * @param int $flags
1088: * @return mixed[]
1089: */
1090: public static function sort(array $array, int $flags = Sorting::REGULAR): array
1091: {
1092: $arr = $array;
1093: if ($flags & Order::DESCENDING) {
1094: arsort($arr, $flags);
1095: } else {
1096: asort($arr, $flags);
1097: }
1098: return $arr;
1099: }
1100:
1101: /**
1102: * @param mixed[] $array
1103: * @param int $flags
1104: * @return mixed[]
1105: */
1106: public static function sortKeys(array $array, int $flags = Sorting::REGULAR): array
1107: {
1108: $arr = $array;
1109: if ($flags & Order::DESCENDING) {
1110: krsort($arr, $flags);
1111: } else {
1112: ksort($arr, $flags);
1113: }
1114: return $arr;
1115: }
1116:
1117: /**
1118: * @param mixed[] $array
1119: * @param callable $function
1120: * @param int $flags
1121: * @return mixed[]
1122: */
1123: public static function sortWith(array $array, callable $function, int $flags = Order::ASCENDING): array
1124: {
1125: $arr = $array;
1126: uasort($arr, $function);
1127: if ($flags & Order::DESCENDING) {
1128: $arr = array_reverse($arr);
1129: }
1130: return $arr;
1131: }
1132:
1133: /**
1134: * @param mixed[] $array
1135: * @param callable $function
1136: * @param int $flags
1137: * @return mixed[]
1138: */
1139: public static function sortKeysWith(array $array, callable $function, int $flags = Order::ASCENDING): array
1140: {
1141: $arr = $array;
1142: uksort($arr, $function);
1143: if ($flags & Order::DESCENDING) {
1144: $arr = array_reverse($arr);
1145: }
1146: return $arr;
1147: }
1148:
1149: /**
1150: * @param mixed[] $array
1151: * @param int $sortFlags
1152: * @return mixed[]
1153: */
1154: public static function distinct(array $array, int $sortFlags = Sorting::REGULAR): array
1155: {
1156: return array_unique($array, $sortFlags);
1157: }
1158:
1159: // merging ---------------------------------------------------------------------------------------------------------
1160:
1161: /**
1162: * @param mixed[] $array
1163: * @param mixed ...$values
1164: * @return mixed[]
1165: */
1166: public static function append(array $array, ...$values): array
1167: {
1168: return self::appendAll($array, $values);
1169: }
1170:
1171: /**
1172: * @param mixed[] $array
1173: * @param mixed[] $values
1174: * @return mixed[]
1175: */
1176: public static function appendAll(array $array, array $values): array
1177: {
1178: foreach ($values as $value) {
1179: $array[] = $value;
1180: }
1181: return $array;
1182: }
1183:
1184: /**
1185: * @param mixed[] $array
1186: * @param mixed ...$values
1187: * @return mixed[]
1188: */
1189: public static function prepend(array $array, ...$values): array
1190: {
1191: return self::prependAll($array, $values);
1192: }
1193:
1194: /**
1195: * @param mixed[] $array
1196: * @param mixed[] $values
1197: * @return mixed[]
1198: */
1199: public static function prependAll(array $array, array $values): array
1200: {
1201: $values = new ReverseArrayIterator($values);
1202: foreach ($values as $value) {
1203: array_unshift($array, $value);
1204: }
1205: return $array;
1206: }
1207:
1208: /**
1209: * @param mixed[] $array
1210: * @param mixed $find
1211: * @param mixed $replace
1212: * @return mixed[]
1213: */
1214: public static function replace(array $array, $find, $replace): array
1215: {
1216: return array_replace($array, [$find => $replace]);
1217: }
1218:
1219: /**
1220: * @param mixed[] $array
1221: * @param mixed[] $replacements
1222: * @return mixed[]
1223: */
1224: public static function replaceAll(array $array, array $replacements): array
1225: {
1226: return array_replace($array, $replacements);
1227: }
1228:
1229: /**
1230: * @param mixed[] $array
1231: * @param int $from
1232: * @param int $length
1233: * @return mixed[]
1234: */
1235: public static function remove(array $array, int $from, int $length = 0): array
1236: {
1237: array_splice($array, $from, $length);
1238: return $array;
1239: }
1240:
1241: /**
1242: * @param mixed[] $array
1243: * @param int $from
1244: * @param mixed[] $patch
1245: * @param int $length
1246: * @return mixed[]
1247: */
1248: public static function patch(array $array, int $from, array $patch, ?int $length = null): array
1249: {
1250: if ($length === null) {
1251: $length = count($patch);
1252: }
1253: array_splice($array, $from, $length, $patch);
1254: return $array;
1255: }
1256:
1257: /**
1258: * @param mixed[] $array
1259: * @param int $from
1260: * @param mixed[] $patch
1261: * @return mixed[]
1262: */
1263: public static function insert(array $array, int $from, array $patch): array
1264: {
1265: array_splice($array, $from, 0, $patch);
1266: return $array;
1267: }
1268:
1269: /**
1270: * @param mixed[] $array
1271: * @param mixed[] ...$args
1272: * @return mixed[]
1273: */
1274: public static function merge(array $array, array ...$args): array
1275: {
1276: return array_merge($array, ...$args);
1277: }
1278:
1279: // diffing ---------------------------------------------------------------------------------------------------------
1280:
1281: /**
1282: * @param mixed[] $array
1283: * @param mixed[] ...$args
1284: * @return mixed[]
1285: */
1286: public static function diff(array $array, array ...$args): array
1287: {
1288: return array_diff($array, ...$args);
1289: }
1290:
1291: /**
1292: * @param mixed[] $array
1293: * @param callable $function
1294: * @param mixed[] ...$args
1295: * @return mixed[]
1296: */
1297: public static function diffWith(array $array, callable $function, array ...$args): array
1298: {
1299: array_push($args, $function);
1300:
1301: return array_udiff($array, ...$args);
1302: }
1303:
1304: /**
1305: * @param mixed[] $array
1306: * @param mixed[] ...$args
1307: * @return mixed[]
1308: */
1309: public static function diffKeys(array $array, array ...$args): array
1310: {
1311: return array_diff_key($array, ...$args);
1312: }
1313:
1314: /**
1315: * @param mixed[] $array
1316: * @param callable $function
1317: * @param mixed[] ...$args
1318: * @return mixed[]
1319: */
1320: public static function diffKeysWith(array $array, callable $function, array ...$args): array
1321: {
1322: $args[] = $function;
1323: return array_diff_ukey($array, ...$args);
1324: }
1325:
1326: /**
1327: * @param mixed[] $array
1328: * @param mixed[] ...$args
1329: * @lastParam callable|null $function
1330: * @return mixed[]
1331: */
1332: public static function diffPairs(array $array, array ...$args): array
1333: {
1334: return array_diff_assoc($array, ...$args);
1335: }
1336:
1337: /**
1338: * @param mixed[] $array
1339: * @param callable|null $function
1340: * @param callable|null $keysFunction
1341: * @param mixed[] ...$args
1342: * @return mixed[]
1343: */
1344: public static function diffPairsWith(array $array, ?callable $function = null, ?callable $keysFunction = null, array ...$args): array
1345: {
1346: if ($function && $keysFunction) {
1347: $args[] = $function;
1348: $args[] = $keysFunction;
1349: return array_udiff_uassoc($array, ...$args);
1350: } elseif ($function && !$keysFunction) {
1351: $args[] = $function;
1352: return array_udiff_assoc($array, ...$args);
1353: } elseif (!$function && $keysFunction) {
1354: $args[] = $keysFunction;
1355: return array_diff_uassoc($array, ...$args);
1356: } else {
1357: return array_diff_assoc($array, ...$args);
1358: }
1359: }
1360:
1361: /**
1362: * @param mixed[] $array
1363: * @param mixed[] ...$args
1364: * @return mixed[]
1365: */
1366: public static function intersect(array $array, array ...$args): array
1367: {
1368: return array_intersect($array, ...$args);
1369: }
1370:
1371: /**
1372: * @param mixed[] $array
1373: * @param callable $function
1374: * @param mixed[] ...$args
1375: * @return mixed[]
1376: */
1377: public static function intersectWith(array $array, callable $function, array ...$args): array
1378: {
1379: $args[] = $function;
1380: return array_uintersect($array, ...$args);
1381: }
1382:
1383: /**
1384: * @param mixed[] $array
1385: * @param mixed[] ...$args
1386: * @return mixed[]
1387: */
1388: public static function intersectKeys(array $array, array ...$args): array
1389: {
1390: return array_intersect_key($array, ...$args);
1391: }
1392:
1393: /**
1394: * @param mixed[] $array
1395: * @param callable $function
1396: * @param mixed[] ...$args
1397: * @return mixed[]
1398: */
1399: public static function intersectKeysWith(array $array, callable $function, array ...$args): array
1400: {
1401: $args[] = $function;
1402: return array_intersect_ukey($array, ...$args);
1403: }
1404:
1405: /**
1406: * @param mixed[] $array
1407: * @param mixed[] ...$args
1408: * @return mixed[]
1409: */
1410: public static function intersectPairs(array $array, array ...$args): array
1411: {
1412: return array_intersect_assoc($array, ...$args);
1413: }
1414:
1415: /**
1416: * @param mixed[] $array
1417: * @param callable|null $function
1418: * @param callable|null $keysFunction
1419: * @param mixed[] ...$args
1420: * @return mixed[]
1421: */
1422: public static function intersectPairsWith(array $array, ?callable $function = null, ?callable $keysFunction = null, array ...$args): array
1423: {
1424: if ($function && $keysFunction) {
1425: $args[] = $function;
1426: $args[] = $keysFunction;
1427: return array_uintersect_uassoc($array, ...$args);
1428: } elseif ($function && !$keysFunction) {
1429: $args[] = $function;
1430: return array_uintersect_assoc($array, ...$args);
1431: } elseif (!$function && $keysFunction) {
1432: $args[] = $keysFunction;
1433: return array_intersect_uassoc($array, ...$args);
1434: } else {
1435: return array_intersect_assoc($array, ...$args);
1436: }
1437: }
1438:
1439: }
| 73 % | common\lists\Collection.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class Collection extends \Dogma\ImmutableArray
13: {
14:
15: /** @var string */
16: protected $accepted;
17:
18: /**
19: * @param string $accepted
20: * @param object[] $items
21: */
22: public function __construct(string $accepted, array $items = [])
23: {
24: Check::className($accepted);
25:
26: parent::__construct($items);
27:
28: foreach ($this as $object) {
29: $this->checkAccepted($object);
30: }
31: $this->accepted = $accepted;
32: }
33:
34: /**
35: * Check if object is of accepted class.
36: * @param object $object
37: * @throws \Dogma\InvalidTypeException
38: */
39: private function checkAccepted(object $object): void
40: {
41: if (!$object instanceof $this->accepted) {
42: throw new \Dogma\InvalidTypeException($this->accepted, get_class($object));
43: }
44: }
45:
46: }
| 99 % | common\lists\ImmutableArray.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class ImmutableArray implements \Countable, \IteratorAggregate, \ArrayAccess
13: {
14: use \Dogma\StrictBehaviorMixin;
15: use \Dogma\ImmutableArrayAccessMixin;
16:
17: /** @internal */
18: private const PRESERVE_KEYS = true;
19:
20: /** @var mixed[] */
21: private $items;
22:
23: /**
24: * @param mixed[] $items
25: */
26: public function __construct(array $items)
27: {
28: $this->items = $items;
29: }
30:
31: /**
32: * @param mixed ...$values
33: * @return static
34: */
35: public static function create(...$values): self
36: {
37: return new static($values);
38: }
39:
40: public static function from(iterable $that): self
41: {
42: return new static(self::convertToArray($that));
43: }
44:
45: public static function combine(iterable $keys, iterable $values): self
46: {
47: $keys = self::convertToArray($keys);
48: $values = self::convertToArray($values);
49:
50: return new static(array_combine($keys, $values));
51: }
52:
53: /**
54: * @param iterable $that
55: * @return mixed[]
56: */
57: private static function convertToArray(iterable $that): array
58: {
59: if (is_array($that)) {
60: return $that;
61: } elseif ($that instanceof self) {
62: return $that->toArray();
63: } elseif ($that instanceof \Traversable) {
64: return iterator_to_array($that);
65: } else {
66: throw new \Dogma\InvalidTypeException(Type::PHP_ARRAY, $that);
67: }
68: }
69:
70: /**
71: * @param int|string $start
72: * @param int|string $end
73: * @param int $step >= 1
74: * @return static
75: */
76: public static function range($start, $end, int $step = 1): self
77: {
78: Check::min($step, 1);
79:
80: return new static(range($start, $end, $step));
81: }
82:
83: public function getIterator(): ArrayIterator
84: {
85: return new ArrayIterator($this->items);
86: }
87:
88: public function getReverseIterator(): ReverseArrayIterator
89: {
90: return new ReverseArrayIterator($this->items);
91: }
92:
93: public function keys(): self
94: {
95: return new static(array_keys($this->toArray()));
96: }
97:
98: public function values(): self
99: {
100: return new static(array_values($this->toArray()));
101: }
102:
103: /**
104: * @return mixed[]
105: */
106: public function toArray(): array
107: {
108: return $this->items;
109: }
110:
111: /**
112: * @return mixed[]
113: */
114: public function toArrayRecursive(): array
115: {
116: $res = $this->toArray();
117: foreach ($res as $key => $value) {
118: $res[$key] = ($value instanceof self ? $value->toArray() : $value);
119: }
120: return $res;
121: }
122:
123: /**
124: * @return mixed
125: */
126: public function randomKey()
127: {
128: return array_rand($this->toArray());
129: }
130:
131: /**
132: * @return mixed
133: */
134: public function randomValue()
135: {
136: return $this[$this->randomKey()];
137: }
138:
139: public function doForEach(callable $function): void
140: {
141: foreach ($this as $value) {
142: $function($value);
143: }
144: }
145:
146: // queries ---------------------------------------------------------------------------------------------------------
147:
148: public function isEmpty(): bool
149: {
150: return count($this->items) === 0;
151: }
152:
153: public function isNotEmpty(): bool
154: {
155: return count($this->items) !== 0;
156: }
157:
158: /**
159: * @param mixed $value
160: * @return bool
161: */
162: public function contains($value): bool
163: {
164: return array_search($value, $this->toArray(), Type::STRICT) !== false;
165: }
166:
167: /**
168: * @param mixed $value
169: * @param int $from
170: * @return mixed|null
171: */
172: public function indexOf($value, int $from = 0)
173: {
174: if ($from > 0) {
175: return $this->drop($from)->indexOf($value);
176: }
177: $result = array_search($value, $this->toArray(), Type::STRICT);
178: if ($result === false) {
179: return null;
180: }
181: return $result;
182: }
183:
184: /**
185: * @param mixed $value
186: * @return static
187: */
188: public function indexesOf($value): self
189: {
190: return new static(array_keys($this->items, $value, Type::STRICT));
191: }
192:
193: /**
194: * @param mixed $value
195: * @param int|null $end
196: * @return mixed|null
197: */
198: public function lastIndexOf($value, ?int $end = null)
199: {
200: if ($end !== null) {
201: return $this->take($end)->indexesOf($value)->last();
202: }
203: return $this->indexesOf($value)->last();
204: }
205:
206: /**
207: * @param callable $function
208: * @param int $from
209: * @return mixed|null
210: */
211: public function indexWhere(callable $function, int $from = 0)
212: {
213: foreach ($this->drop($from) as $key => $value) {
214: if ($function($value)) {
215: return $key;
216: }
217: }
218: return null;
219: }
220:
221: /**
222: * @param callable $function
223: * @param int $end
224: * @return mixed
225: */
226: public function lastIndexWhere(callable $function, ?int $end = null)
227: {
228: return $this->take($end)->reverse()->indexWhere($function);
229: }
230:
231: /**
232: * @param int|string $key
233: * @return bool
234: */
235: public function containsKey($key): bool
236: {
237: return $this->offsetExists($key);
238: }
239:
240: public function exists(callable $function): bool
241: {
242: foreach ($this as $value) {
243: if ($function($value)) {
244: return true;
245: }
246: }
247: return false;
248: }
249:
250: public function forAll(callable $function): bool
251: {
252: foreach ($this as $value) {
253: if (!$function($value)) {
254: return false;
255: }
256: }
257: return true;
258: }
259:
260: /**
261: * @param callable $function
262: * @return mixed|null
263: */
264: public function find(callable $function)
265: {
266: foreach ($this as $value) {
267: if ($function($value)) {
268: return $value;
269: }
270: }
271: return null;
272: }
273:
274: public function prefixLength(callable $function): int
275: {
276: return $this->segmentLength($function, 0);
277: }
278:
279: public function segmentLength(callable $function, int $from = 0): int
280: {
281: $i = 0;
282: $that = $this->drop($from);
283: foreach ($that as $value) {
284: if (!$function($value)) {
285: break;
286: }
287: $i++;
288: }
289: return $i;
290: }
291:
292: // stats -----------------------------------------------------------------------------------------------------------
293:
294: public function count(?callable $function = null): int
295: {
296: if ($function === null) {
297: return count($this->toArray());
298: }
299: $count = 0;
300: foreach ($this as $value) {
301: if ($function($value)) {
302: $count++;
303: }
304: }
305: return $count;
306: }
307:
308: public function size(): int
309: {
310: return count($this->items);
311: }
312:
313: public function countValues(): self
314: {
315: return new static(array_count_values($this->toArray()));
316: }
317:
318: /**
319: * @return mixed|null
320: */
321: public function max()
322: {
323: if ($this->isEmpty()) {
324: return null;
325: }
326: return max($this->toArray());
327: }
328:
329: /**
330: * @return mixed|null
331: */
332: public function min()
333: {
334: if ($this->isEmpty()) {
335: return null;
336: }
337: return min($this->toArray());
338: }
339:
340: /**
341: * @param callable $function
342: * @return mixed|null
343: */
344: public function maxBy(callable $function)
345: {
346: if ($this->isEmpty()) {
347: return null;
348: }
349: $max = $this->map($function)->max();
350: return $this->find(function ($value) use ($max, $function) {
351: return $function($value) === $max;
352: });
353: }
354:
355: /**
356: * @param callable $function
357: * @return mixed|null
358: */
359: public function minBy(callable $function)
360: {
361: if ($this->isEmpty()) {
362: return null;
363: }
364: $min = $this->map($function)->min();
365: return $this->find(function ($value) use ($min, $function) {
366: return $function($value) === $min;
367: });
368: }
369:
370: /**
371: * @return int|float
372: */
373: public function product()
374: {
375: return array_product($this->toArray());
376: }
377:
378: /**
379: * @return int|float
380: */
381: public function sum()
382: {
383: return array_sum($this->toArray());
384: }
385:
386: // comparison ------------------------------------------------------------------------------------------------------
387:
388: public function containsSlice(iterable $array): bool
389: {
390: return $this->indexOfSlice($array, 0) !== null;
391: }
392:
393: public function indexOfSlice(iterable $array, int $from = 0): ?int
394: {
395: /** @var self $that */
396: $that = $this->drop($from);
397: while ($that->isNotEmpty()) {
398: if ($that->startsWith($array)) {
399: return $from;
400: }
401: $from++;
402: $that = $that->tail();
403: }
404:
405: return null;
406: }
407:
408: public function corresponds(iterable $array, callable $function): bool
409: {
410: $iterator = $this->getIterator();
411: $iterator->rewind();
412: foreach ($array as $value) {
413: if (!$iterator->valid() || !$function($iterator->current(), $value)) {
414: return false;
415: }
416: $iterator->next();
417: }
418: return !$iterator->valid();
419: }
420:
421: public function hasSameElements(iterable $array): bool
422: {
423: return $this->corresponds($array, function ($a, $b) {
424: return $a === $b;
425: });
426: }
427:
428: public function startsWith(iterable $slice, int $from = 0): bool
429: {
430: /** @var \Iterator $iterator */
431: $iterator = $this->drop($from)->getIterator();
432: $iterator->rewind();
433: foreach ($slice as $value) {
434: if ($iterator->valid() && $value === $iterator->current()) {
435: $iterator->next();
436: } else {
437: return false;
438: }
439: }
440: return true;
441: }
442:
443: public function endsWith(iterable $slice): bool
444: {
445: $slice = Arr::toArray($slice);
446:
447: return $this->startsWith($slice, $this->count() - count($slice));
448: }
449:
450: // transforming ----------------------------------------------------------------------------------------------------
451:
452: /**
453: * @param callable $function
454: * @param mixed $init
455: * @return mixed|null
456: */
457: public function fold(callable $function, $init = null)
458: {
459: return $this->foldLeft($function, $init);
460: }
461:
462: /**
463: * @param callable $function
464: * @param mixed $init
465: * @return mixed|null
466: */
467: public function foldLeft(callable $function, $init = null)
468: {
469: return array_reduce($this->toArray(), $function, $init);
470: }
471:
472: /**
473: * @param callable $function
474: * @param mixed $init
475: * @return mixed|null
476: */
477: public function foldRight(callable $function, $init = null)
478: {
479: foreach ($this->getReverseIterator() as $value) {
480: $init = $function($value, $init);
481: }
482: return $init;
483: }
484:
485: /**
486: * @param callable $function
487: * @return mixed|null
488: */
489: public function reduce(callable $function)
490: {
491: return $this->reduceLeft($function);
492: }
493:
494: /**
495: * @param callable $function
496: * @return mixed|null
497: */
498: public function reduceLeft(callable $function)
499: {
500: if ($this->isEmpty()) {
501: return null;
502: }
503: return $this->tail()->foldLeft($function, $this->head());
504: }
505:
506: /**
507: * @param callable $function
508: * @return mixed|null
509: */
510: public function reduceRight(callable $function)
511: {
512: if ($this->isEmpty()) {
513: return null;
514: }
515: return $this->init()->foldRight($function, $this->last());
516: }
517:
518: /**
519: * @param callable $function
520: * @param mixed $init
521: * @return static
522: */
523: public function scanLeft(callable $function, $init): self
524: {
525: $res = [];
526: $res[] = $init;
527: foreach ($this as $value) {
528: $res[] = $init = $function($init, $value);
529: }
530: return new static($res);
531: }
532:
533: /**
534: * @param callable $function
535: * @param mixed $init
536: * @return static
537: */
538: public function scanRight(callable $function, $init): self
539: {
540: $res = [];
541: $res[] = $init;
542: foreach ($this->getReverseIterator() as $value) {
543: $init = $function($value, $init);
544: array_unshift($res, $init);
545: }
546: return new static($res);
547: }
548:
549: // slicing ---------------------------------------------------------------------------------------------------------
550:
551: /**
552: * @return mixed|null
553: */
554: public function head()
555: {
556: if (count($this->items) === 0) {
557: return null;
558: }
559: return reset($this->items);
560: }
561:
562: /**
563: * Alias of head()
564: * @return mixed|null
565: */
566: public function first()
567: {
568: if (count($this->items) === 0) {
569: return null;
570: }
571: return reset($this->items);
572: }
573:
574: /**
575: * @return mixed|null
576: */
577: public function last()
578: {
579: if (count($this->items) === 0) {
580: return null;
581: }
582: return end($this->items);
583: }
584:
585: public function init(): self
586: {
587: return $this->slice(0, -1);
588: }
589:
590: public function tail(): self
591: {
592: return $this->drop(1);
593: }
594:
595: public function inits(): self
596: {
597: $res = [$this];
598: $that = $this;
599: while ($that->isNotEmpty()) {
600: $res[] = $that = $that->init();
601: }
602: return new static($res);
603: }
604:
605: public function tails(): self
606: {
607: $res = [$this];
608: $that = $this;
609: while ($that->isNotEmpty()) {
610: $res[] = $that = $that->tail();
611: }
612: return new static($res);
613: }
614:
615: /**
616: * @return mixed[] (mixed $head, static $tail)
617: */
618: public function headTail(): array
619: {
620: return [$this->head(), $this->tail()];
621: }
622:
623: /**
624: * @return mixed[] (static $init, mixed $last)
625: */
626: public function initLast(): array
627: {
628: return [$this->init(), $this->last()];
629: }
630:
631: public function slice(int $from, ?int $length = null): self
632: {
633: return new static(array_slice($this->toArray(), $from, $length, self::PRESERVE_KEYS));
634: }
635:
636: public function chunks(int $size): self
637: {
638: /** @var self $res */
639: $res = new static(array_chunk($this->toArray(), $size, self::PRESERVE_KEYS));
640: return $res->map(function ($array) {
641: return new static($array);
642: });
643: }
644:
645: public function sliding(int $size, int $step = 1): self
646: {
647: $res = [];
648: for ($i = 0; $i <= $this->count() - $size + $step - 1; $i += $step) {
649: $res[] = $this->slice($i, $size);
650: }
651: return new static($res);
652: }
653:
654: public function drop(int $count): self
655: {
656: return $this->slice($count, $this->count());
657: }
658:
659: public function dropRight(int $count): self
660: {
661: return $this->slice(0, $this->count() - $count);
662: }
663:
664: public function dropWhile(callable $function): self
665: {
666: $res = [];
667: $go = false;
668: foreach ($this as $key => $value) {
669: if (!$function($value)) {
670: $go = true;
671: }
672: if ($go) {
673: $res[$key] = $value;
674: }
675: }
676: return new static($res);
677: }
678:
679: /**
680: * @param int $length
681: * @param mixed $value
682: * @return static
683: */
684: public function padTo(int $length, $value): self
685: {
686: return new static(array_pad($this->toArray(), $length, $value));
687: }
688:
689: /**
690: * @param callable $function
691: * @return static[] (static $l, static $r)
692: */
693: public function span(callable $function): array
694: {
695: $l = [];
696: $r = [];
697: $toLeft = true;
698: foreach ($this as $key => $value) {
699: $toLeft = $toLeft && $function($value);
700: if ($toLeft) {
701: $l[$key] = $value;
702: } else {
703: $r[$key] = $value;
704: }
705: }
706: return [new static($l), new static($r)];
707: }
708:
709: public function take(?int $count = null): self
710: {
711: return $this->slice(0, $count);
712: }
713:
714: public function takeRight(int $count): self
715: {
716: return $this->slice(-$count, $count);
717: }
718:
719: public function takeWhile(callable $function): self
720: {
721: $res = [];
722: foreach ($this as $key => $value) {
723: if (!$function($value)) {
724: break;
725: }
726: $res[$key] = $value;
727: }
728: return new static($res);
729: }
730:
731: // filtering -------------------------------------------------------------------------------------------------------
732:
733: public function collect(callable $function): self
734: {
735: return $this->map($function)->filter();
736: }
737:
738: public function filter(?callable $function = null): self
739: {
740: if ($function) {
741: return new static(array_filter($this->toArray(), $function));
742: } else {
743: return new static(array_filter($this->toArray()));
744: }
745: }
746:
747: public function filterKeys(callable $function): self
748: {
749: $res = [];
750: foreach ($this as $key => $value) {
751: if ($function($key)) {
752: $res[$key] = $value;
753: }
754: }
755: return new static($res);
756: }
757:
758: public function filterNot(callable $function): self
759: {
760: return $this->filter(function ($value) use ($function) {
761: return !$function($value);
762: });
763: }
764:
765: /**
766: * @param callable $function
767: * @return static[] (static $fist, static $second)
768: */
769: public function partition(callable $function): array
770: {
771: $a = [];
772: $b = [];
773: foreach ($this as $key => $value) {
774: if ($function($value)) {
775: $a[$key] = $value;
776: } else {
777: $b[$key] = $value;
778: }
779: }
780: return [new static($a), new static($b)];
781: }
782:
783: // mapping ---------------------------------------------------------------------------------------------------------
784:
785: public function flatMap(callable $function): self
786: {
787: return $this->map($function)->flatten();
788: }
789:
790: public function flatten(): self
791: {
792: $res = [];
793: foreach ($this as $values) {
794: if (is_array($values)) {
795: foreach (Arr::flatten($values) as $value) {
796: $res[] = $value;
797: }
798: } elseif ($values instanceof self) {
799: foreach ($values->flatten() as $value) {
800: $res[] = $value;
801: }
802: } else {
803: $res[] = $values;
804: }
805: }
806: return new static($res);
807: }
808:
809: public function groupBy(callable $function): self
810: {
811: $res = [];
812: foreach ($this as $key => $value) {
813: $groupKey = $function($value);
814: $res[$groupKey][$key] = $value;
815: }
816: /** @var self $r */
817: $r = new static($res);
818: return $r->map(function ($array) {
819: return new static($array);
820: });
821: }
822:
823: public function map(callable $function): self
824: {
825: return new static(array_map($function, $this->toArray()));
826: }
827:
828: public function mapPairs(callable $function): self
829: {
830: return $this->remap(function ($key, $value) use ($function) {
831: return [$key => $function($key, $value)];
832: });
833: }
834:
835: public function remap(callable $function): self
836: {
837: $res = [];
838: foreach ($this as $key => $value) {
839: foreach ($function($key, $value) as $newKey => $newValue) {
840: $res[$newKey] = $newValue;
841: }
842: }
843: return new static($res);
844: }
845:
846: public function flip(): self
847: {
848: return new static(array_flip($this->toArray()));
849: }
850:
851: public function transpose(): self
852: {
853: $arr = $this->toArray();
854: if ($this->isEmpty()) {
855: return new static($arr);
856: }
857: array_unshift($arr, null);
858: $arr = array_map(...$arr);
859: foreach ($arr as $key => $value) {
860: $arr[$key] = (array) $value;
861: }
862: return new static($arr);
863: }
864:
865: /**
866: * @param mixed $valueKey
867: * @param mixed|null $indexKey
868: * @return static
869: */
870: public function column($valueKey, $indexKey = null): self
871: {
872: return new static(array_column($this->toArrayRecursive(), $valueKey, $indexKey));
873: }
874:
875: // sorting ---------------------------------------------------------------------------------------------------------
876:
877: public function reverse(): self
878: {
879: return new static(array_reverse($this->toArray(), self::PRESERVE_KEYS));
880: }
881:
882: public function shuffle(): self
883: {
884: $arr = $this->toArray();
885: shuffle($arr);
886: return new static($arr);
887: }
888:
889: public function sort(int $flags = Sorting::REGULAR): self
890: {
891: $arr = $this->toArray();
892: if ($flags & Order::DESCENDING) {
893: arsort($arr, $flags);
894: } else {
895: asort($arr, $flags);
896: }
897: return new static($arr);
898: }
899:
900: public function sortKeys(int $flags = Sorting::REGULAR): self
901: {
902: $arr = $this->toArray();
903: if ($flags & Order::DESCENDING) {
904: krsort($arr, $flags);
905: } else {
906: ksort($arr, $flags);
907: }
908: return new static($arr);
909: }
910:
911: public function sortWith(callable $function, int $flags = Order::ASCENDING): self
912: {
913: $arr = $this->toArray();
914: uasort($arr, $function);
915: if ($flags & Order::DESCENDING) {
916: $arr = array_reverse($arr);
917: }
918: return new static($arr);
919: }
920:
921: public function sortKeysWith(callable $function, int $flags = Order::ASCENDING): self
922: {
923: $arr = $this->toArray();
924: uksort($arr, $function);
925: if ($flags & Order::DESCENDING) {
926: $arr = array_reverse($arr);
927: }
928: return new static($arr);
929: }
930:
931: public function distinct(int $sortFlags = Sorting::REGULAR): self
932: {
933: $arr = $this->toArray();
934: $arr = array_unique($arr, $sortFlags);
935: return new static($arr);
936: }
937:
938: // merging ---------------------------------------------------------------------------------------------------------
939:
940: /**
941: * @param mixed ...$values
942: * @return static
943: */
944: public function append(...$values): self
945: {
946: return $this->appendAll($values);
947: }
948:
949: public function appendAll(iterable $values): self
950: {
951: $res = $this->toArray();
952: foreach ($values as $value) {
953: $res[] = $value;
954: }
955: return new static($res);
956: }
957:
958: /**
959: * @param mixed ...$values
960: * @return static
961: */
962: public function prepend(...$values): self
963: {
964: return $this->prependAll($values);
965: }
966:
967: public function prependAll(iterable $values): self
968: {
969: if (!is_array($values)) {
970: $values = self::convertToArray($values);
971: }
972: foreach ($this as $value) {
973: $values[] = $value;
974: }
975: return new static($values);
976: }
977:
978: /**
979: * @param mixed $find
980: * @param mixed $replace
981: * @return static
982: */
983: public function replace($find, $replace): self
984: {
985: $arr = $this->toArray();
986: $arr = array_replace($arr, [$find => $replace]);
987: return new static($arr);
988: }
989:
990: public function replaceAll(iterable $replacements): self
991: {
992: if (!is_array($replacements)) {
993: $replacements = self::convertToArray($replacements);
994: }
995: $arr = $this->toArray();
996: $arr = array_replace($arr, $replacements);
997: return new static($arr);
998: }
999:
1000: /**
1001: * @param int $from
1002: * @param int $length
1003: * @return static
1004: */
1005: public function remove(int $from, int $length = 0): self
1006: {
1007: $arr = $this->toArray();
1008: array_splice($arr, $from, $length);
1009: return new static($arr);
1010: }
1011:
1012: /**
1013: * @param int $from
1014: * @param mixed[] $patch
1015: * @param int $length
1016: * @return static
1017: */
1018: public function patch(int $from, array $patch, ?int $length = null): self
1019: {
1020: $arr = $this->toArray();
1021: if ($length === null) {
1022: $length = count($patch);
1023: }
1024: array_splice($arr, $from, $length, $patch);
1025: return new static($arr);
1026: }
1027:
1028: public function insert(int $from, array $patch): self
1029: {
1030: $arr = $this->toArray();
1031: array_splice($arr, $from, 0, $patch);
1032: return new static($arr);
1033: }
1034:
1035: public function merge(iterable $that): self
1036: {
1037: if (!is_array($that)) {
1038: $that = self::convertToArray($that);
1039: }
1040: $self = $this->toArray();
1041: return new static(array_merge($self, $that));
1042: }
1043:
1044: // diffing ---------------------------------------------------------------------------------------------------------
1045:
1046: public function diff(iterable ...$args): self
1047: {
1048: $self = $this->toArray();
1049: $args = array_map([self::class, 'convertToArray'], $args);
1050: array_unshift($args, $self);
1051:
1052: $arr = array_diff(...$args);
1053:
1054: return new static($arr);
1055: }
1056:
1057: public function diffWith(callable $function, iterable ...$args): self
1058: {
1059: $self = $this->toArray();
1060: $args = array_map([self::class, 'convertToArray'], $args);
1061: array_unshift($args, $self);
1062: $args[] = $function;
1063:
1064: $arr = array_udiff(...$args);
1065:
1066: return new static($arr);
1067: }
1068:
1069: public function diffKeys(iterable ...$args): self
1070: {
1071: $self = $this->toArray();
1072: $args = array_map([self::class, 'convertToArray'], $args);
1073: array_unshift($args, $self);
1074:
1075: $arr = array_diff_key(...$args);
1076:
1077: return new static($arr);
1078: }
1079:
1080: public function diffKeysWith(callable $function, iterable ...$args): self
1081: {
1082: $self = $this->toArray();
1083: $args = array_map([self::class, 'convertToArray'], $args);
1084: array_unshift($args, $self);
1085: $args[] = $function;
1086:
1087: $arr = array_diff_ukey(...$args);
1088:
1089: return new static($arr);
1090: }
1091:
1092: public function diffPairs(iterable ...$args): self
1093: {
1094: $self = $this->toArray();
1095: $args = array_map([self::class, 'convertToArray'], $args);
1096: array_unshift($args, $self);
1097:
1098: $arr = array_diff_assoc(...$args);
1099:
1100: return new static($arr);
1101: }
1102:
1103: public function diffPairsWith(?callable $function = null, ?callable $keysFunction = null, iterable ...$args): self
1104: {
1105: $self = $this->toArray();
1106: $args = array_map([self::class, 'convertToArray'], $args);
1107: array_unshift($args, $self);
1108:
1109: if ($function && $keysFunction) {
1110: $args[] = $function;
1111: $args[] = $keysFunction;
1112: $arr = array_udiff_uassoc(...$args);
1113: } elseif ($function && !$keysFunction) {
1114: $args[] = $function;
1115: $arr = array_udiff_assoc(...$args);
1116: } elseif (!$function && $keysFunction) {
1117: $args[] = $keysFunction;
1118: $arr = array_diff_uassoc(...$args);
1119: } else {
1120: $arr = array_diff_assoc(...$args);
1121: }
1122: return new static($arr);
1123: }
1124:
1125: public function intersect(iterable ...$args): self
1126: {
1127: $self = $this->toArray();
1128: $args = array_map([self::class, 'convertToArray'], $args);
1129: array_unshift($args, $self);
1130:
1131: $arr = array_intersect(...$args);
1132:
1133: return new static($arr);
1134: }
1135:
1136: public function intersectWith(callable $function, iterable ...$args): self
1137: {
1138: $self = $this->toArray();
1139: $args = array_map([self::class, 'convertToArray'], $args);
1140: array_unshift($args, $self);
1141: $args[] = $function;
1142:
1143: $arr = array_uintersect(...$args);
1144:
1145: return new static($arr);
1146: }
1147:
1148: public function intersectKeys(iterable ...$args): self
1149: {
1150: $self = $this->toArray();
1151: $args = array_map([self::class, 'convertToArray'], $args);
1152: array_unshift($args, $self);
1153:
1154: $arr = array_intersect_key(...$args);
1155:
1156: return new static($arr);
1157: }
1158:
1159: public function intersectKeysWith(callable $function, iterable ...$args): self
1160: {
1161: $self = $this->toArray();
1162: $args = array_map([self::class, 'convertToArray'], $args);
1163: array_unshift($args, $self);
1164: $args[] = $function;
1165:
1166: $arr = array_intersect_ukey(...$args);
1167:
1168: return new static($arr);
1169: }
1170:
1171: public function intersectPairs(iterable ...$args): self
1172: {
1173: $self = $this->toArray();
1174: $args = array_map([self::class, 'convertToArray'], $args);
1175: array_unshift($args, $self);
1176:
1177: $arr = array_intersect_assoc(...$args);
1178:
1179: return new static($arr);
1180: }
1181:
1182: public function intersectPairsWith(?callable $function = null, ?callable $keysFunction = null, iterable ...$args): self
1183: {
1184: $self = $this->toArray();
1185: $args = array_map([self::class, 'convertToArray'], $args);
1186: array_unshift($args, $self);
1187:
1188: if ($function && $keysFunction) {
1189: $args[] = $function;
1190: $args[] = $keysFunction;
1191: $arr = array_uintersect_uassoc(...$args);
1192: } elseif ($function && !$keysFunction) {
1193: $args[] = $function;
1194: $arr = array_uintersect_assoc(...$args);
1195: } elseif (!$function && $keysFunction) {
1196: $args[] = $keysFunction;
1197: $arr = array_intersect_uassoc(...$args);
1198: } else {
1199: $arr = array_intersect_assoc(...$args);
1200: }
1201: return new static($arr);
1202: }
1203:
1204: }
| 100 % | common\lists\ImmutableArrayAccessMixin.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: trait ImmutableArrayAccessMixin
13: {
14:
15: /**
16: * @param mixed $key
17: * @return bool
18: */
19: public function offsetExists($key): bool
20: {
21: return array_key_exists($key, $this->toArray());
22: }
23:
24: /**
25: * @param mixed $key
26: * @return mixed
27: */
28: public function offsetGet($key)
29: {
30: return $this->items[$key];
31: }
32:
33: /**
34: * @param mixed $key
35: * @param mixed $value
36: * @throws \BadMethodCallException
37: */
38: public function offsetSet($key, $value): void
39: {
40: throw new \BadMethodCallException('Cannot modify an item of immutable list.');
41: }
42:
43: /**
44: * @param mixed $key
45: * @throws \BadMethodCallException
46: */
47: public function offsetUnset($key): void
48: {
49: throw new \BadMethodCallException('Cannot unset an item of immutable list.');
50: }
51:
52: }
| 100 % | common\lists\Tuple.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: /**
13: * Immutable list of fixed number of parameters
14: */
15: class Tuple implements \Countable, \IteratorAggregate, \ArrayAccess
16: {
17: use \Dogma\StrictBehaviorMixin;
18: use \Dogma\ImmutableArrayAccessMixin;
19:
20: /** @var mixed[] */
21: private $items;
22:
23: /**
24: * @param mixed ...$items
25: */
26: public function __construct(...$items)
27: {
28: $this->items = $items;
29: }
30:
31: public function count(): int
32: {
33: return count($this->items);
34: }
35:
36: public function getIterator(): ArrayIterator
37: {
38: return new ArrayIterator($this->items);
39: }
40:
41: /**
42: * @return mixed[]
43: */
44: public function toArray(): array
45: {
46: return $this->items;
47: }
48:
49: }
| 100 % | common\mixins\exceptions\NonCloneableObjectException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: final class NonCloneableObjectException extends \Dogma\Exception
13: {
14:
15: public function __construct(string $class, ?\Throwable $previous = null)
16: {
17: parent::__construct(sprintf('Cloning a non-cloneable object of class %s.', $class), $previous);
18: }
19:
20: }
| 100 % | common\mixins\exceptions\NonIterableObjectException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: final class NonIterableObjectException extends \Dogma\Exception
13: {
14:
15: public function __construct(string $class, ?\Throwable $previous = null)
16: {
17: parent::__construct(sprintf('Iterating a non-iterable object of class %s.', $class), $previous);
18: }
19:
20: }
| 100 % | common\mixins\exceptions\NonSerializableObjectException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: final class NonSerializableObjectException extends \Dogma\Exception
13: {
14:
15: public function __construct(string $class, ?\Throwable $previous = null)
16: {
17: parent::__construct(sprintf('Serializing a non-serializable object of class %s.', $class), $previous);
18: }
19:
20: }
| 100 % | common\mixins\exceptions\StaticClassException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class StaticClassException extends \Dogma\Exception
13: {
14:
15: public function __construct(string $class, ?\Throwable $previous = null)
16: {
17: parent::__construct(sprintf('Cannot instantiate a static class %s.', $class), $previous);
18: }
19:
20: }
| 100 % | common\mixins\exceptions\UndefinedMethodException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class UndefinedMethodException extends \Dogma\Exception
13: {
14:
15: public function __construct(string $class, string $method, ?\Throwable $previous = null)
16: {
17: parent::__construct(sprintf('Method %s::%s() is not defined or is not accessible', $class, $method), $previous);
18: }
19:
20: }
| 100 % | common\mixins\exceptions\UndefinedPropertyException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class UndefinedPropertyException extends \Dogma\Exception
13: {
14:
15: public function __construct(string $class, string $property, ?\Throwable $previous = null)
16: {
17: parent::__construct(sprintf('Property %s::$%s is not defined or is not accessible', $class, $property), $previous);
18: }
19:
20: }
| 100 % | common\mixins\NonCloneableMixin.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: trait NonCloneableMixin
13: {
14:
15: /**
16: * To avoid cloning a non cloneable object
17: * @deprecated
18: * @throws \Dogma\NonCloneableObjectException
19: */
20: final public function __clone()
21: {
22: throw new \Dogma\NonCloneableObjectException(get_class($this));
23: }
24:
25: }
| 100 % | common\mixins\NonIterable.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: interface NonIterable extends \IteratorAggregate
13: {
14:
15: }
| 100 % | common\mixins\NonIterableMixin.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: trait NonIterableMixin
13: {
14:
15: /**
16: * To avoid iterating through an object by accident
17: * @deprecated
18: * @throws \Dogma\NonIterableObjectException
19: */
20: public function getIterator(): void
21: {
22: throw new \Dogma\NonIterableObjectException(get_class($this));
23: }
24:
25: }
| 100 % | common\mixins\NonSerializableMixin.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: trait NonSerializableMixin
13: {
14:
15: /**
16: * To avoid serializing a non serializable object
17: * @deprecated
18: * @throws \Dogma\NonSerializableObjectException
19: */
20: final public function __sleep(): void
21: {
22: throw new \Dogma\NonSerializableObjectException(get_class($this));
23: }
24:
25: /**
26: * To avoid serializing a non serializable object
27: * @deprecated
28: * @throws \Dogma\NonSerializableObjectException
29: */
30: final public function __wakeup(): void
31: {
32: throw new \Dogma\NonSerializableObjectException(get_class($this));
33: }
34:
35: }
| 100 % | common\mixins\StaticClassMixin.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: trait StaticClassMixin
13: {
14:
15: /**
16: * @throws \Dogma\StaticClassException
17: */
18: final public function __construct()
19: {
20: throw new \Dogma\StaticClassException(get_called_class());
21: }
22:
23: /**
24: * Call to undefined static method
25: * @deprecated
26: * @param string $name
27: * @param mixed $args
28: * @throws \Dogma\UndefinedMethodException
29: */
30: public static function __callStatic(string $name, $args): void
31: {
32: throw new \Dogma\UndefinedMethodException(get_called_class(), $name);
33: }
34:
35: }
| 100 % | common\mixins\StrictBehaviorMixin.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: trait StrictBehaviorMixin
13: {
14:
15: /**
16: * Call to undefined method
17: * @deprecated
18: * @param string $name
19: * @param mixed $args
20: * @throws \Dogma\UndefinedMethodException
21: */
22: public function __call(string $name, $args): void
23: {
24: throw new \Dogma\UndefinedMethodException(get_class($this), $name);
25: }
26:
27: /**
28: * Call to undefined static method
29: * @deprecated
30: * @param string $name
31: * @param mixed $args
32: * @throws \Dogma\UndefinedMethodException
33: */
34: public static function __callStatic(string $name, $args): void
35: {
36: throw new \Dogma\UndefinedMethodException(get_called_class(), $name);
37: }
38:
39: /**
40: * Access to undefined property
41: * @deprecated
42: * @param string $name
43: * @throws \Dogma\UndefinedPropertyException
44: */
45: public function &__get(string $name): void
46: {
47: throw new \Dogma\UndefinedPropertyException(get_class($this), $name);
48: }
49:
50: /**
51: * Write to undefined property
52: * @deprecated
53: * @param string $name
54: * @param mixed $value
55: * @throws \Dogma\UndefinedPropertyException
56: */
57: public function __set(string $name, $value): void
58: {
59: throw new \Dogma\UndefinedPropertyException(get_class($this), $name);
60: }
61:
62: /**
63: * Isset undefined property
64: * @deprecated
65: * @param string $name
66: * @throws \Dogma\UndefinedPropertyException
67: */
68: public function __isset(string $name): void
69: {
70: throw new \Dogma\UndefinedPropertyException(get_class($this), $name);
71: }
72:
73: /**
74: * Unset undefined property
75: * @deprecated
76: * @param string $name
77: * @throws \Dogma\UndefinedPropertyException
78: */
79: public function __unset(string $name): void
80: {
81: throw new \Dogma\UndefinedPropertyException(get_class($this), $name);
82: }
83:
84: }
| 0 % | common\types\Char.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma;
4:
5: class Char
6: {
7: use \Dogma\StaticClassMixin;
8:
9: public const NUL = "\x00"; // null
10: public const SOH = "\x01"; // start of header
11: public const STX = "\x02"; // start of text
12: public const ETX = "\x03"; // end of text
13: public const EOT = "\x04"; // end of transmission
14: public const ENQ = "\x05"; // enquiry
15: public const ACK = "\x06"; // acknowledge
16: public const BEL = "\x07"; // bell
17: public const BS = "\x08"; // backspace
18: public const HT = "\x09"; // horizontal tab
19: public const LF = "\x0A"; // line feed
20: public const VT = "\x0B"; // vertical tab
21: public const FF = "\x0C"; // form feed
22: public const CR = "\x0D"; // enter / carriage return
23: public const SO = "\x0E"; // shift out
24: public const SI = "\x0F"; // shift in
25: public const DLE = "\x10"; // data link escape
26: public const DC1 = "\x11"; // device control 1
27: public const DC2 = "\x12"; // device control 2
28: public const DC3 = "\x13"; // device control 3
29: public const DC4 = "\x14"; // device control 4
30: public const NAK = "\x15"; // negative acknowledge
31: public const SYN = "\x16"; // synchronize
32: public const ETB = "\x17"; // end of trans. block
33: public const CAN = "\x18"; // cancel
34: public const EM = "\x19"; // end of medium
35: public const SUB = "\x1A"; // substitute
36: public const ESC = "\x1B"; // escape
37: public const FS = "\x1C"; // file separator
38: public const GS = "\x1D"; // group separator
39: public const RS = "\x1E"; // record separator
40: public const US = "\x1F"; // unit separator
41: public const DEL = "\x7F"; // delete
42:
43: public const NULL = "\x00";
44: public const START_OF_HEADER = "\x01";
45: public const START_OF_TEXT = "\x02";
46: public const END_OF_TEXT = "\x03";
47: public const END_OF_TRANSMISSION = "\x04";
48: public const ENQUIRY = "\x05";
49: public const ACKNOWLEDGE = "\x06";
50: public const BELL = "\x07";
51: public const BACKSPACE = "\x08";
52: public const HORIZONTAL_TAB = "\x09";
53: public const LINE_FEED = "\x0A";
54: public const VERTICAL_TAB = "\x0B";
55: public const FORM_FEED = "\x0C";
56: public const CARRIAGE_RETURN = "\x0D";
57: public const SHIFT_OUT = "\x0E";
58: public const SHIFT_IN = "\x0F";
59: public const DATA_LINK_ESCAPE = "\x10";
60: public const DEVICE_CONTROL_1 = "\x11";
61: public const DEVICE_CONTROL_2 = "\x12";
62: public const DEVICE_CONTROL_3 = "\x13";
63: public const DEVICE_CONTROL_4 = "\x14";
64: public const NEGATIVE_ACKNOWLEDGE = "\x15";
65: public const SYNCHRONIZE = "\x16";
66: public const END_OF_TRANSMISSION_BLOCK = "\x17";
67: public const CANCEL = "\x18";
68: public const END_OF_MEDIUM = "\x19";
69: public const SUBSTITUTE = "\x1A";
70: public const ESCAPE = "\x1B";
71: public const FILE_SEPARATOR = "\x1C";
72: public const GROUP_SEPARATOR = "\x1D";
73: public const RECORD_SEPARATOR = "\x1E";
74: public const UNIT_SEPARATOR = "\x1F";
75: public const DELETE = "\x7F";
76:
77: }
| 79 % | common\types\Check.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: /**
13: * Type and range validations
14: */
15: final class Check
16: {
17: use \Dogma\StaticClassMixin;
18:
19: // min length
20: public const NOT_EMPTY = 1;
21:
22: // strict type checks
23: public const STRICT = true;
24:
25: /**
26: * @param mixed $value
27: * @param string|string[] $type
28: * @param int|float|null $min
29: * @param int|float|null $max
30: * @throws \Dogma\InvalidTypeException
31: * @throws \Dogma\ValueOutOfRangeException
32: */
33: public static function type(&$value, $type, $min = null, $max = null): void
34: {
35: if (is_array($type)) {
36: [$type, $itemTypes] = $type;
37: }
38: switch ($type) {
39: case Type::NULL:
40: if (!is_null($value)) {
41: throw new \Dogma\InvalidTypeException($type, $value);
42: }
43: break;
44: case Type::BOOL:
45: if ($min !== null) {
46: throw new \InvalidArgumentException(sprintf('Parameter $min is not applicable with type %s.', $type));
47: } elseif ($max !== null) {
48: throw new \InvalidArgumentException(sprintf('Parameter $max is not applicable with type %s.', $type));
49: }
50: self::bool($value);
51: break;
52: case Type::INT:
53: self::int($value, $min, $max);
54: break;
55: case Type::FLOAT:
56: self::float($value, $min, $max);
57: break;
58: case Type::STRING:
59: self::string($value, $min, $max);
60: break;
61: case Type::PHP_ARRAY:
62: self::array($value, $min, $max);
63: break;
64: case Type::OBJECT:
65: if ($min !== null) {
66: throw new \InvalidArgumentException(sprintf('Parameter $min is not applicable with type %s.', $type));
67: } elseif ($max !== null) {
68: throw new \InvalidArgumentException(sprintf('Parameter $max is not applicable with type %s.', $type));
69: }
70: self::object($value);
71: break;
72: case Type::RESOURCE:
73: if ($max !== null) {
74: throw new \InvalidArgumentException(sprintf('Parameter $max is not applicable with type %s.', $type));
75: }
76: self::resource($value, $min);
77: break;
78: case Type::PHP_CALLABLE:
79: if ($max !== null) {
80: throw new \InvalidArgumentException(sprintf('Parameter $max is not applicable with type %s.', $type));
81: }
82: self::callable($value);
83: break;
84: default:
85: if ($min !== null) {
86: throw new \InvalidArgumentException(sprintf('Parameter $min is not applicable with type %s.', $type));
87: } elseif ($max !== null) {
88: throw new \InvalidArgumentException(sprintf('Parameter $max is not applicable with type %s.', $type));
89: }
90: self::object($value, $type);
91: break;
92: }
93: if (isset($itemTypes)) {
94: self::itemsOfTypes($value, $itemTypes);
95: }
96: }
97:
98: /**
99: * @param mixed $value
100: * @param string $type
101: * @param int|float|null $min
102: * @param int|float|null $max
103: * @throws \Dogma\InvalidTypeException
104: * @throws \Dogma\ValueOutOfRangeException
105: */
106: public static function nullableType(&$value, string $type, $min = null, $max = null): void
107: {
108: if ($value === null) {
109: return;
110: }
111: self::type($value, $type, $min, $max);
112: }
113:
114: /**
115: * @param mixed $value
116: * @param string[] $types
117: * @param int|float|null $min
118: * @param int|float|null $max
119: * @throws \Dogma\InvalidTypeException
120: */
121: public static function types(&$value, array $types, $min = null, $max = null): void
122: {
123: foreach ($types as $type) {
124: if ($type === Type::NULL && $value === null) {
125: return;
126: }
127: try {
128: self::type($value, $type, $min, $max);
129: return;
130: } catch (\Dogma\InvalidTypeException $e) {
131: // pass
132: }
133: }
134: throw new \Dogma\InvalidTypeException($types, $value);
135: }
136:
137: /**
138: * @param iterable $items
139: * @param string $type
140: * @param int|float|null $valueMin
141: * @param int|float|null $valueMax
142: * @throws \Dogma\InvalidTypeException
143: */
144: public static function itemsOfType(iterable $items, string $type, $valueMin = null, $valueMax = null): void
145: {
146: foreach ($items as &$value) {
147: self::type($value, $type, $valueMin, $valueMax);
148: }
149: }
150:
151: /**
152: * @param iterable $items
153: * @param string[] $types
154: * @param int|float|null $valueMin
155: * @param int|float|null $valueMax
156: * @throws \Dogma\InvalidTypeException
157: */
158: public static function itemsOfTypes(iterable $items, array $types, $valueMin = null, $valueMax = null): void
159: {
160: foreach ($items as &$value) {
161: self::types($value, $types, $valueMin, $valueMax);
162: }
163: }
164:
165: /**
166: * @param mixed $value
167: * @throws \Dogma\InvalidTypeException
168: */
169: public static function null($value): void
170: {
171: if ($value !== null) {
172: throw new \Dogma\InvalidTypeException(Type::NULL, $value);
173: }
174: }
175:
176: /**
177: * @param mixed $value
178: * @throws \Dogma\InvalidTypeException
179: */
180: public static function bool(&$value): void
181: {
182: if ($value === true || $value === false) {
183: return;
184: }
185: if ($value === 0 || $value === 1 || $value === 0.0 || $value === 1.0 || $value === ''
186: || $value === '0' || $value === '1' || $value === '0.0' || $value === '1.0'
187: ) {
188: $value = (bool) (int) $value;
189: return;
190: }
191: throw new \Dogma\InvalidTypeException(Type::BOOL, $value);
192: }
193:
194: /**
195: * @param mixed $value
196: * @throws \Dogma\InvalidTypeException
197: */
198: public static function nullableBool(&$value): void
199: {
200: if ($value === null) {
201: return;
202: }
203: self::bool($value);
204: }
205:
206: /**
207: * @param mixed $value
208: * @param int|null $min
209: * @param int|null $max
210: * @throws \Dogma\InvalidTypeException
211: * @throws \Dogma\ValueOutOfRangeException
212: */
213: public static function int(&$value, ?int $min = null, ?int $max = null): void
214: {
215: if (is_integer($value)) {
216: if ($min !== null || $max !== null) {
217: self::range($value, $min, $max);
218: }
219: return;
220: }
221: if (!is_numeric($value)) {
222: throw new \Dogma\InvalidTypeException(Type::INT, $value);
223: }
224: $actualType = gettype($value);
225: $converted = (int) $value;
226: $copy = $converted;
227: settype($copy, $actualType);
228: if ($copy !== $value && (!is_string($value) || rtrim(rtrim($value, '0'), '.') !== $copy)) {
229: throw new \Dogma\InvalidTypeException(Type::INT, $value);
230: }
231: if ($min !== null || $max !== null) {
232: self::range($value, $min, $max);
233: }
234: $value = $converted;
235: }
236:
237: /**
238: * @param mixed $value
239: * @param int|null $min
240: * @param int|null $max
241: * @throws \Dogma\InvalidTypeException
242: * @throws \Dogma\ValueOutOfRangeException
243: */
244: public static function nullableInt(&$value, ?int $min = null, ?int $max = null): void
245: {
246: if ($value === null) {
247: return;
248: }
249: self::int($value, $min, $max);
250: }
251:
252: /**
253: * @param mixed $value
254: * @param float|null $min
255: * @param float|null $max
256: * @throws \Dogma\InvalidTypeException
257: * @throws \Dogma\InvalidValueException
258: * @throws \Dogma\ValueOutOfRangeException
259: */
260: public static function float(&$value, ?float $min = null, ?float $max = null): void
261: {
262: if (is_float($value)) {
263: if (is_nan($value)) {
264: throw new \Dogma\InvalidValueException($value, 'valid float');
265: }
266: if ($value === INF || $value === -INF) {
267: throw new \Dogma\ValueOutOfRangeException($value, -INF, INF);
268: }
269: if ($min !== null || $max !== null) {
270: self::range($value, $min, $max);
271: }
272: if ($value === -0.0) {
273: $value = 0.0;
274: }
275: return;
276: }
277: if (!is_numeric($value)) {
278: throw new \Dogma\InvalidTypeException(Type::FLOAT, $value);
279: }
280: $actualType = gettype($value);
281: $converted = (float) $value;
282: if ($converted === INF || $converted === -INF) {
283: throw new \Dogma\ValueOutOfRangeException($value, -INF, INF);
284: }
285: $copy = $converted;
286: settype($copy, $actualType);
287: if ($copy !== $value && (!is_string($value) || rtrim(rtrim($value, '0'), '.') !== $copy)) {
288: throw new \Dogma\InvalidTypeException(Type::FLOAT, $value);
289: }
290: if ($min !== null || $max !== null) {
291: self::range($value, $min, $max);
292: }
293: if ($converted === -0.0) {
294: $converted = 0.0;
295: }
296: $value = $converted;
297: }
298:
299: /**
300: * @param mixed $value
301: * @param float|null $min
302: * @param float|null $max
303: * @throws \Dogma\InvalidTypeException
304: * @throws \Dogma\InvalidValueException
305: * @throws \Dogma\ValueOutOfRangeException
306: */
307: public static function nullableFloat(&$value, ?float $min = null, ?float $max = null): void
308: {
309: if ($value === null) {
310: return;
311: }
312: self::float($value, $min, $max);
313: }
314:
315: /**
316: * @param mixed $value
317: * @param int|null $minLength
318: * @param int|null $maxLength
319: * @throws \Dogma\InvalidTypeException
320: * @throws \Dogma\ValueOutOfRangeException
321: */
322: public static function string(&$value, ?int $minLength = null, ?int $maxLength = null): void
323: {
324: if (is_string($value)) {
325: if ($minLength !== null || $maxLength !== null) {
326: self::length($value, $minLength, $maxLength);
327: }
328: return;
329: }
330: if (!is_numeric($value)) {
331: throw new \Dogma\InvalidTypeException(Type::STRING, $value);
332: }
333: self::float($value);
334: $value = (string) $value;
335: }
336:
337: /**
338: * @param mixed $value
339: * @param int|null $minLength
340: * @param int|null $maxLength
341: * @throws \Dogma\InvalidTypeException
342: * @throws \Dogma\ValueOutOfRangeException
343: */
344: public static function nullableString(&$value, ?int $minLength = null, ?int $maxLength = null): void
345: {
346: if ($value === null) {
347: return;
348: }
349: self::string($value, $minLength, $maxLength);
350: }
351:
352: /**
353: * @param mixed $value
354: * @throws \Dogma\InvalidTypeException
355: */
356: public static function traversable($value): void
357: {
358: if (!self::isIterable($value)) {
359: throw new \Dogma\InvalidTypeException('array|Traversable', $value);
360: }
361: }
362:
363: /**
364: * @param mixed $value
365: * @param int|null $minLength
366: * @param int|null $maxLength
367: * @throws \Dogma\InvalidTypeException
368: */
369: public static function array($value, ?int $minLength = null, ?int $maxLength = null): void
370: {
371: if (!is_array($value)) {
372: throw new \Dogma\InvalidTypeException(Type::PHP_ARRAY, $value);
373: }
374: self::range(count($value), $minLength, $maxLength);
375: }
376:
377: /**
378: * @param mixed $value
379: * @param int|null $minLength
380: * @param int|null $maxLength
381: * @throws \Dogma\InvalidTypeException
382: */
383: public static function plainArray($value, ?int $minLength = null, ?int $maxLength = null): void
384: {
385: self::array($value, $minLength, $maxLength);
386: if (!self::isPlainArray($value)) {
387: throw new \Dogma\InvalidTypeException('array with integer keys from 0', $value);
388: }
389: }
390:
391: /**
392: * @param mixed $value
393: * @param string[] $types
394: * @throws \Dogma\InvalidTypeException
395: * @throws \Dogma\ValueOutOfRangeException
396: */
397: public static function tuple($value, array $types): void
398: {
399: self::object($value, Tuple::class);
400: self::range(count($value), $length = count($types), $length);
401: foreach ($value as $i => $val) {
402: self::type($val, $types[$i]);
403: }
404: }
405:
406: /**
407: * @param mixed $value
408: * @param string[] $types
409: * @throws \Dogma\InvalidTypeException
410: * @throws \Dogma\ValueOutOfRangeException
411: */
412: public function nullableTuple($value, array $types): void
413: {
414: if ($value === null) {
415: return;
416: }
417: self::tuple($value, $types);
418: }
419:
420: /**
421: * @param mixed $value
422: * @param string|null $className
423: * @throws \Dogma\InvalidTypeException
424: */
425: public static function object($value, ?string $className = null): void
426: {
427: if (!is_object($value)) {
428: throw new \Dogma\InvalidTypeException(Type::OBJECT, $value);
429: }
430: if ($className !== null && !is_a($value, $className)) {
431: throw new \Dogma\InvalidTypeException($className, $value);
432: }
433: }
434:
435: /**
436: * @param mixed $value
437: * @param string|null $className
438: * @throws \Dogma\InvalidTypeException
439: */
440: public static function nullableObject($value, ?string $className = null): void
441: {
442: if ($value === null) {
443: return;
444: }
445: self::object($value, $className);
446: }
447:
448: /**
449: * @param mixed $value
450: * @param string $type
451: * @throws \Dogma\InvalidTypeException
452: */
453: public static function resource($value, ?string $type = null): void
454: {
455: if (!is_resource($value)) {
456: throw new \Dogma\InvalidTypeException(Type::RESOURCE, $value);
457: }
458: if ($type !== null && get_resource_type($value) !== $type) {
459: throw new \Dogma\InvalidTypeException(sprintf('%s (%s)', Type::RESOURCE, $type), $value);
460: }
461: }
462:
463: /**
464: * @param mixed $value
465: * @throws \Dogma\InvalidTypeException
466: */
467: public static function callable($value): void
468: {
469: if (!is_callable($value)) {
470: throw new \Dogma\InvalidTypeException('callable', $value);
471: }
472: }
473:
474: /**
475: * @param mixed $value
476: * @param string $parentClass
477: * @throws \Dogma\InvalidValueException
478: */
479: public static function className($value, ?string $parentClass = null): void
480: {
481: self::string($value);
482: if (!class_exists($value, true)) {
483: throw new \Dogma\InvalidValueException($value, 'class name');
484: }
485: if ($parentClass !== null && !is_subclass_of($value, $parentClass)) {
486: throw new \Dogma\InvalidTypeException(sprintf('child class of %s', $parentClass), $value);
487: }
488: }
489:
490: /**
491: * @param mixed $value
492: * @throws \Dogma\InvalidValueException
493: */
494: public static function typeName($value): void
495: {
496: self::string($value);
497: if (!class_exists($value, true) && !in_array($value, Type::listTypes())) {
498: throw new \Dogma\InvalidValueException($value, 'type name');
499: }
500: }
501:
502: /**
503: * @param string $value
504: * @param int|null $min
505: * @param int|null $max
506: * @throws \Dogma\ValueOutOfRangeException
507: */
508: public static function length(string $value, ?int $min = null, ?int $max = null): void
509: {
510: $length = Str::length($value);
511: self::range($length, $min, $max);
512: }
513:
514: /**
515: * @param mixed[] $value
516: * @param int|null $min
517: * @param int|null $max
518: * @throws \Dogma\ValueOutOfRangeException
519: */
520: public static function count(array $value, ?int $min = null, ?int $max = null): void
521: {
522: $count = count($value);
523: self::range($count, $min, $max);
524: }
525:
526: /**
527: * @param string $value
528: * @param string $regexp
529: * @throws \Dogma\InvalidValueException
530: */
531: public static function match(string $value, string $regexp): void
532: {
533: if (!preg_match($regexp, $value)) {
534: throw new \Dogma\InvalidValueException($value, $regexp);
535: }
536: }
537:
538: /**
539: * Checks type specific bounds
540: * @param mixed $value
541: * @param \Dogma\Type $type
542: * @throws \Dogma\ValueOutOfRangeException
543: */
544: public static function bounds($value, Type $type): void
545: {
546: if ($type->isInt()) {
547: try {
548: self::range($value, ...BitSize::getIntRange($type->getSize(), $type->isSigned()));
549: } catch (\Dogma\ValueOutOfRangeException $e) {
550: throw new \Dogma\ValueOutOfBoundsException($value, $type, $e);
551: }
552: } elseif ($type->isFloat() && $type->getSize() === BitSize::BITS_32) {
553: $length = strlen(rtrim(str_replace('.', '', $value), '0'));
554: // single precision float can handle up to 9 digits of precision
555: if ($length > 9) {
556: throw new \Dogma\ValueOutOfBoundsException($value, $type);
557: }
558: } elseif ($type->isString()) {
559: try {
560: /// todo: take into account string encoding?
561: self::range(Str::length($value), 0, $type->getSize());
562: } catch (\Dogma\ValueOutOfRangeException $e) {
563: throw new \Dogma\ValueOutOfBoundsException($value, $type, $e);
564: }
565: } else {
566: throw new \Dogma\InvalidArgumentException(sprintf('Cannot check bounds of type %s.', $type->getId()));
567: }
568: }
569:
570: /**
571: * Checks user defined range
572: * @param mixed $value
573: * @param int|float|null $min
574: * @param int|float|null $max
575: * @throws \Dogma\ValueOutOfRangeException
576: */
577: public static function range($value, $min = null, $max = null): void
578: {
579: if ($min !== null && $value < $min) {
580: throw new \Dogma\ValueOutOfRangeException($value, $min, $max);
581: }
582: if ($max !== null && $value > $max) {
583: throw new \Dogma\ValueOutOfRangeException($value, $min, $max);
584: }
585: }
586:
587: /**
588: * @param mixed $value
589: * @param int|float $min
590: * @throws \Dogma\ValueOutOfRangeException
591: */
592: public static function min($value, $min): void
593: {
594: if ($value < $min) {
595: throw new \Dogma\ValueOutOfRangeException($value, $min, null);
596: }
597: }
598:
599: /**
600: * @param mixed $value
601: * @param int|float $max
602: * @throws \Dogma\ValueOutOfRangeException
603: */
604: public static function max($value, $max): void
605: {
606: if ($value > $max) {
607: throw new \Dogma\ValueOutOfRangeException($value, null, $max);
608: }
609: }
610:
611: /**
612: * @param int|float $value
613: * @throws \Dogma\ValueOutOfRangeException
614: */
615: public static function positive($value): void
616: {
617: if ($value <= 0) {
618: throw new \Dogma\ValueOutOfRangeException($value, 0, null);
619: }
620: }
621:
622: /**
623: * @param int|float $value
624: * @throws \Dogma\ValueOutOfRangeException
625: */
626: public static function nonNegative($value): void
627: {
628: if ($value < 0) {
629: throw new \Dogma\ValueOutOfRangeException($value, 0, null);
630: }
631: }
632:
633: /**
634: * @param int|float $value
635: * @throws \Dogma\ValueOutOfRangeException
636: */
637: public static function nonPositive($value): void
638: {
639: if ($value > 0) {
640: throw new \Dogma\ValueOutOfRangeException($value, null, 0);
641: }
642: }
643:
644: /**
645: * @param int|float $value
646: * @throws \Dogma\ValueOutOfRangeException
647: */
648: public static function negative($value): void
649: {
650: if ($value >= 0) {
651: throw new \Dogma\ValueOutOfRangeException($value, null, 0);
652: }
653: }
654:
655: /**
656: * @param mixed ...$values
657: * @throws \Dogma\ValueOutOfRangeException
658: */
659: public static function oneOf(...$values): void
660: {
661: $count = 0;
662: foreach ($values as $value) {
663: if (isset($value)) {
664: $count++;
665: }
666: }
667: if ($count !== 1) {
668: throw new \Dogma\ValueOutOfRangeException($count, 1, 1);
669: }
670: }
671:
672: /**
673: * @param mixed $value
674: * @return bool
675: */
676: public static function isIterable($value): bool
677: {
678: return is_array($value)
679: || $value instanceof \stdClass
680: || ($value instanceof \Traversable && !$value instanceof NonIterable);
681: }
682:
683: /**
684: * @param mixed $value
685: * @return bool
686: */
687: public static function isPlainArray($value): bool
688: {
689: if (!is_array($value)) {
690: return false;
691: }
692: $count = count($value);
693:
694: return $count === 0 || array_keys($value) === range(0, $count - 1);
695: }
696:
697: }
| 0 % | common\types\exceptions\InvalidArgumentException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class InvalidArgumentException extends \Dogma\InvalidValueException
13: {
14:
15: public function __construct(string $message, ?\Throwable $previous = null)
16: {
17: \Dogma\Exception::__construct($message, $previous);
18: }
19:
20: }
| 0 % | common\types\exceptions\InvalidInterfaceException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class InvalidInterfaceException extends \Dogma\InvalidTypeException
13: {
14:
15: /**
16: * @param string $expectedInterface
17: * @param mixed $value
18: * @param \Throwable|null $previous
19: */
20: public function __construct(string $expectedInterface, $value, ?\Throwable $previous = null)
21: {
22: if (is_object($value)) {
23: $type = get_class($value);
24: } else {
25: $type = gettype($value);
26: }
27: $class = true;
28: if (interface_exists($expectedInterface)) {
29: $class = false;
30: }
31: if ($class) {
32: \Dogma\Exception::__construct(sprintf('Expected an instance of %s. %s given.', $expectedInterface, $type), $previous);
33: } else {
34: \Dogma\Exception::__construct(sprintf('Expected an object implementing %s. %s given.', $expectedInterface, $type), $previous);
35: }
36: }
37:
38: }
| 0 % | common\types\exceptions\InvalidRegularExpressionException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class InvalidRegularExpressionException extends \Dogma\InvalidValueException
13: {
14:
15: /**
16: * @param mixed $regexp
17: * @param \Throwable|null $previous
18: */
19: public function __construct($regexp, ?\Throwable $previous = null)
20: {
21: \Dogma\Exception::__construct(
22: sprintf('Value \'%s\' is not a valid regular expression.', $regexp),
23: $previous
24: );
25: }
26:
27: }
| 0 % | common\types\exceptions\InvalidSizeException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class InvalidSizeException extends \Dogma\Exception
13: {
14:
15: /**
16: * @param string|\Dogma\Type $type
17: * @param int|int[] $actualSize
18: * @param int[]|string[] $allowedSizes
19: * @param \Throwable|null $previous
20: */
21: public function __construct($type, $actualSize, array $allowedSizes, ?\Throwable $previous = null)
22: {
23: if (!$allowedSizes) {
24: parent::__construct(sprintf('Size parameter is not allowed on type %s.', ExceptionTypeFormatter::format($type)), $previous);
25: } else {
26: $sizes = implode(', ', $allowedSizes);
27: if (is_array($actualSize)) {
28: $actualSize = implode(',', $actualSize);
29: }
30: parent::__construct(sprintf('Size %s is not valid for type %s. Allowed sizes: %s.', $actualSize, ExceptionTypeFormatter::format($type), $sizes), $previous);
31: }
32: }
33:
34: }
| 0 % | common\types\exceptions\InvalidTypeDefinitionException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class InvalidTypeDefinitionException extends \Dogma\Exception
13: {
14:
15: public function __construct(string $definition, ?\Throwable $previous = null)
16: {
17: $example = '\\Tuple<int(64,unsigned),float,\DateTime?>';
18: parent::__construct(sprintf(
19: 'Type definition \'%s\' is invalid. Example of valid complex type definition: \'%s\'.',
20: $definition,
21: $example
22: ), $previous);
23: }
24:
25: }
| 100 % | common\types\exceptions\InvalidTypeException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class InvalidTypeException extends \Dogma\Exception
13: {
14:
15: /**
16: * @param string|string[] $expectedType
17: * @param string|object $actualType
18: * @param \Throwable|null $previous
19: */
20: public function __construct($expectedType, $actualType, ?\Throwable $previous = null)
21: {
22: parent::__construct(
23: sprintf('Expected a value of type %s. %s given.', ExceptionTypeFormatter::format($expectedType), ExceptionTypeFormatter::format($actualType)),
24: $previous
25: );
26: }
27:
28: }
| 89 % | common\types\exceptions\InvalidValueException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class InvalidValueException extends \Dogma\Exception
13: {
14:
15: /** @var mixed */
16: protected $value;
17:
18: /**
19: * @param mixed $value
20: * @param string $type
21: * @param \Throwable|null $previous
22: */
23: public function __construct($value, $type, ?\Throwable $previous = null)
24: {
25: parent::__construct(
26: sprintf('Value %s is not a valid value of %s.', ExceptionValueFormatter::format($value), ExceptionTypeFormatter::format($type)),
27: $previous
28: );
29:
30: $this->value = $value;
31: }
32:
33: /**
34: * @return mixed
35: */
36: public function getValue()
37: {
38: return $this->value;
39: }
40:
41: }
| 100 % | common\types\exceptions\ValueOutOfBoundsException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class ValueOutOfBoundsException extends \Dogma\ValueOutOfRangeException
13: {
14:
15: /**
16: * @param int|float|string $value
17: * @param string|\Dogma\Type $type
18: * @param \Throwable|null $previous
19: */
20: public function __construct($value, $type, ?\Throwable $previous = null)
21: {
22: \Dogma\Exception::__construct(
23: sprintf('Value %s cannot fit to data type %s.', ExceptionValueFormatter::format($value), ExceptionTypeFormatter::format($type)),
24: $previous
25: );
26: }
27:
28: }
| 80 % | common\types\exceptions\ValueOutOfRangeException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class ValueOutOfRangeException extends \Dogma\InvalidValueException
13: {
14:
15: /**
16: * @param int|float $value
17: * @param int|float|null $min
18: * @param int|float|null $max
19: * @param \Throwable|null $previous
20: */
21: public function __construct($value, $min, $max, ?\Throwable $previous = null)
22: {
23: if ($min === null) {
24: \Dogma\Exception::__construct(
25: sprintf('Expected a value lower than %s. Value %s given.', $max, ExceptionValueFormatter::format($value)),
26: $previous
27: );
28: } elseif ($max === null) {
29: \Dogma\Exception::__construct(
30: sprintf('Expected a value higher than %s. Value %s given.', $min, ExceptionValueFormatter::format($value)),
31: $previous
32: );
33: } else {
34: \Dogma\Exception::__construct(
35: sprintf('Expected a value within the range of %s and %s. Value %s given.', $min, $max, ExceptionValueFormatter::format($value)),
36: $previous
37: );
38: }
39: }
40:
41: }
| 0 % | common\types\Regexp.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: /**
13: * Regular expression object
14: */
15: class Regexp
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: public const DOLLAR_MATCH_END_ONLY = 'D';
20: public const CASE_INSENSITIVE = 'i';
21: public const MULTILINE = 'm';
22: public const DOT_MATCH_EOL = 's';
23: public const UNICODE = 'u';
24: public const UNGREEDY = 'U';
25: public const IGNORE_WHITE_SPACE = 'x';
26:
27: /** @var string */
28: private $pattern;
29:
30: public function __construct(string $pattern)
31: {
32: $this->pattern = $pattern;
33: }
34:
35: public function __toString(): string
36: {
37: return $this->pattern;
38: }
39:
40: /**
41: * Splits string by a regular expression.
42: * @param string $subject
43: * @param int $flags
44: * @return string[]
45: */
46: public function split(string $subject, int $flags = 0): array
47: {
48: return Str::split($subject, $this->pattern, $flags);
49: }
50:
51: /**
52: * Performs a regular expression match.
53: * @param string $subject
54: * @param int $flags
55: * @param int $offset
56: * @return string[]
57: */
58: public function match(string $subject, int $flags = 0, int $offset = 0): array
59: {
60: return Str::match($subject, $this->pattern, $flags, $offset);
61: }
62:
63: /**
64: * Performs a global regular expression match.
65: * @param string $subject
66: * @param int $flags (PREG_SET_ORDER is default)
67: * @param int $offset
68: * @return string[][]
69: */
70: public function matchAll(string $subject, int $flags = 0, int $offset = 0): array
71: {
72: return Str::matchAll($subject, $this->pattern, $flags, $offset);
73: }
74:
75: /**
76: * Perform a regular expression search and replace.
77: * @param string $subject
78: * @param string|callable $replacement
79: * @param int $limit
80: * @return string
81: */
82: public function replace(string $subject, $replacement = null, int $limit = -1): string
83: {
84: return Str::replace($subject, $this->pattern, $replacement, $limit);
85: }
86:
87: }
| 100 % | common\types\ResourceType.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: class ResourceType extends \Dogma\Enum\StringEnum
13: {
14:
15: public const ASPELL = 'aspell';
16: public const BZIP2 = 'bzip2';
17: public const COM = 'COM';
18: public const VARIANT = 'VARIANT';
19: public const CPDF = 'cpdf';
20: public const CPDF_OUTLINE = 'cpdf outline';
21: public const CUBRID_CONNECTION = 'cubrid connection';
22: public const PERSISTENT_CUBRID_CONNECTION = 'persistent cubrid connection';
23: public const CUBRID_REQUEST = 'cubrid request';
24: public const CUBRID_LOB = 'cubrid lob';
25: public const CUBRID_LOB2 = 'cubrid lob2';
26: public const CURL = 'curl';
27: public const DBM = 'dbm';
28: public const DBA = 'dba';
29: public const DBA_PERSISTENT = 'dba persistent';
30: public const DBASE = 'dbase';
31: public const DBX_LINK_OBJECT = 'dbx_link_object';
32: public const DBX_RESULT_OBJECT = 'dbx_result_object';
33: public const XPATH_CONTEXT = 'xpath context';
34: public const XPATH_OBJECT = 'xpath object';
35: public const FBSQL_LINK = 'fbsql link';
36: public const FBSQL_PLINK = 'fbsql plink';
37: public const FBSQL_RESULT = 'fbsql result';
38: public const FDF = 'fdf';
39: public const FTP = 'ftp';
40: public const GD = 'gd';
41: public const GD_FONT = 'gd font';
42: public const GD_PS_ENCODING = 'gd PS encoding';
43: public const GD_PS_FONT = 'gd PS font';
44: public const GMP_INTEGER = 'GMP integer';
45: public const HYPERWAVE_DOCUMENT = 'hyperwave document';
46: public const HYPERWAVE_LINK = 'hyperwave link';
47: public const HYPERWAVE_LINK_PERSISTENT = 'hyperwave link persistent';
48: public const ICAP = 'icap';
49: public const IMAP = 'imap';
50: public const IMAP_CHAIN_PERSISTENT = 'imap chain persistent';
51: public const IMAP_PERSISTENT = 'imap persistent';
52: public const INGRES = 'ingres';
53: public const INGRES_PERSISTENT = 'ingres persistent';
54: public const INTERBASE_BLOB = 'interbase blob';
55: public const INTERBASE_LINK = 'interbase link';
56: public const INTERBASE_LINK_PERSISTENT = 'interbase link persistent';
57: public const INTERBASE_QUERY = 'interbase query';
58: public const INTERBASE_RESULT = 'interbase result';
59: public const INTERBASE_TRANSACTION = 'interbase transaction';
60: public const JAVA = 'java';
61: public const LDAP_LINK = 'ldap link';
62: public const LDAP_RESULT = 'ldap result';
63: public const LDAP_RESULT_ENTRY = 'ldap result entry';
64: public const MCAL = 'mcal';
65: public const SWF_ACTION = 'SWFAction';
66: public const SWF_BITMAP = 'SWFBitmap';
67: public const SWF_BUTTON = 'SWFButton';
68: public const SWF_DISPLAY_ITEM = 'SWFDisplayItem';
69: public const SWF_FILL = 'SWFFill';
70: public const SWF_FONT = 'SWFFont';
71: public const SWF_GRADIENT = 'SWFGradient';
72: public const SWF_MORPH = 'SWFMorph';
73: public const SWF_MOVIE = 'SWFMovie';
74: public const SWF_SHAPE = 'SWFShape';
75: public const SWF_SPRITE = 'SWFSprite';
76: public const SWF_TEXT = 'SWFText';
77: public const SWF_TEXT_FIELD = 'SWFTextField';
78: public const MNOGOSEARCH_AGENT = 'mnogosearch agent';
79: public const MNOGOSEARCH_RESULT = 'mnogosearch result';
80: public const MSQL_LINK = 'msql link';
81: public const MSQL_LINK_PERSISTENT = 'msql link persistent';
82: public const MSQL_QUERY = 'msql query';
83: public const MSSQL_LINK = 'mssql link';
84: public const MSSQL_LINK_PERSISTENT = 'mssql link persistent';
85: public const MSSQL_RESULT = 'mssql result';
86: public const MYSQL_LINK = 'mysql link';
87: public const MYSQL_LINK_PERSISTENT = 'mysql link persistent';
88: public const MYSQL_RESULT = 'mysql result';
89: public const OCI8_COLLECTION = 'oci8 collection';
90: public const OCI8_CONNECTION = 'oci8 connection';
91: public const OCI8_LOB = 'oci8 lob';
92: public const OCI8_STATEMENT = 'oci8 statement';
93: public const ODBC_LINK = 'odbc link';
94: public const ODBC_LINK_PERSISTENT = 'odbc link persistent';
95: public const ODBC_RESULT = 'odbc result';
96: public const BIRDSTEP_LINK = 'birdstep link';
97: public const BIRDSTEP_RESULT = 'birdstep result';
98: public const OPENSSL_KEY = 'OpenSSL key';
99: public const OPENSSL_X509 = 'OpenSSL X.509';
100: public const PDF_DOCUMENT = 'pdf document';
101: public const PDF_IMAGE = 'pdf image';
102: public const PDF_OBJECT = 'pdf object';
103: public const PDF_OUTLINE = 'pdf outline';
104: public const PGSQL_LARGE_OBJECT = 'pgsql large object';
105: public const PGSQL_LINK = 'pgsql link';
106: public const PGSQL_LINK_PERSISTENT = 'pgsql link persistent';
107: public const PGSQL_RESULT = 'pgsql result';
108: public const PGSQL_STRING = 'pgsql string';
109: public const PRINTER = 'printer';
110: public const PRINTER_BRUSH = 'printer brush';
111: public const PRINTER_FONT = 'printer font';
112: public const PRINTER_PEN = 'printer pen';
113: public const PSPELL = 'pspell';
114: public const PSPELL_CONFIG = 'pspell config';
115: public const SABLOTRON_XSLT = 'Sablotron XSLT';
116: public const SHMOP = 'shmop';
117: public const SOCKETS_FILE_DESCRIPTOR_SET = 'sockets file descriptor set';
118: public const SOCKETS_IO_VECTOR = 'sockets i/o vector';
119: public const STREAM = 'stream';
120: public const SOCKET = 'socket';
121: public const SYBASE_DB_LINK = 'sybase-db link';
122: public const SYBASE_DB_LINK_PERSISTENT = 'sybase-db link persistent';
123: public const SYBASE_DB_RESULT = 'sybase-db result';
124: public const SYBASE_CT_LINK = 'sybase-ct link';
125: public const SYBASE_CT_LINK_PERSISTENT = 'sybase-ct link persistent';
126: public const SYBASE_CT_RESULT = 'sybase-ct result';
127: public const SYSVSEM = 'sysvsem';
128: public const SYSVSHM = 'sysvshm';
129: public const WDDX = 'wddx';
130: public const XML = 'xml';
131: public const ZLIB = 'zlib';
132:
133: }
| 55 % | common\types\Str.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma;
11:
12: use Dogma\Language\Collator;
13: use Dogma\Language\Locale\Locale;
14: use Dogma\Language\Transliterator;
15: use Dogma\Language\UnicodeCharacterCategory;
16:
17: /**
18: * UTF-8 strings manipulation
19: */
20: class Str extends \Nette\Utils\Strings
21: {
22:
23: /**
24: * Test equality with another string
25: * @param string $first
26: * @param string $second
27: * @param string|\Collator|\Dogma\Language\Locale\Locale $collation
28: * @return bool
29: */
30: public function equals(string $first, string $second, $collation = CaseComparison::CASE_SENSITIVE): bool
31: {
32: return self::compare($first, $second, $collation) === 0;
33: }
34:
35: /**
36: * Compare to another string
37: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
38: * @param string $first
39: * @param string $second
40: * @param string|\Collator|\Dogma\Language\Locale\Locale $collation
41: * @return int
42: */
43: public static function compare($first, $second, $collation = CaseComparison::CASE_SENSITIVE): int
44: {
45: if ($collation === CaseComparison::CASE_SENSITIVE) {
46: return strcmp($first, $second);
47: } elseif ($collation === CaseComparison::CASE_INSENSITIVE) {
48: return strcasecmp($first, $second);
49: } elseif (is_string($collation) || $collation instanceof Locale) {
50: $collation = new Collator($collation);
51: } elseif (!$collation instanceof \Collator) {
52: throw new \Dogma\InvalidValueException($collation, [Type::STRING, \Collator::class, Locale::class]);
53: }
54: return $collation->compare($first, $second);
55: }
56:
57: public function substringCount(string $string, string $substring): int
58: {
59: return (strlen($string) - strlen(str_replace($substring, '', $string))) / strlen($substring);
60: }
61:
62: public static function toFirst(string $string, string $search): string
63: {
64: $pos = strpos($string, $search);
65: if ($pos === false) {
66: return $string;
67: }
68:
69: return substr($string, 0, $pos);
70: }
71:
72: public static function fromFirst(string $string, string $search): string
73: {
74: $pos = strpos($string, $search);
75: if ($pos === false) {
76: return '';
77: }
78:
79: return substr($string, $pos + 1);
80: }
81:
82: /**
83: * @param string $string
84: * @param string $search
85: * @return string[]
86: */
87: public static function splitByFirst(string $string, string $search): array
88: {
89: $pos = strpos($string, $search);
90: if ($pos === false) {
91: return [$string, ''];
92: }
93:
94: return [substr($string, 0, $pos), substr($string, $pos + 1)];
95: }
96:
97: /**
98: * Levenshtein distance for UTF-8 with additional weights for accent and case differences.
99: * Expects input strings to be normalized UTF-8.
100: *
101: * @param string $string1
102: * @param string $string2
103: * @param float $insertionCost
104: * @param float $deletionCost
105: * @param float $replacementCost
106: * @param float|null $replacementAccentCost
107: * @param float|null $replacementCaseCost
108: * @return float
109: */
110: public static function levenshteinUnicode(
111: string $string1,
112: string $string2,
113: float $insertionCost = 1.0,
114: float $deletionCost = 1.0,
115: float $replacementCost = 1.0,
116: ?float $replacementAccentCost = 0.5,
117: ?float $replacementCaseCost = 0.25
118: ): float
119: {
120: if ($string1 === $string2) {
121: return 0;
122: }
123:
124: $length1 = mb_strlen($string1, 'UTF-8');
125: $length2 = mb_strlen($string2, 'UTF-8');
126: if ($length1 < $length2) {
127: return self::levenshteinUnicode(
128: $string2,
129: $string1,
130: $insertionCost,
131: $deletionCost,
132: $replacementCost,
133: $replacementAccentCost,
134: $replacementCaseCost
135: );
136: }
137: if ($length1 === 0) {
138: return (float) $length2;
139: }
140:
141: $previousRow = range(0.0, $length2);
142: for ($i = 0; $i < $length1; $i++) {
143: $currentRow = [];
144: $currentRow[0] = $i + 1.0;
145: $char1 = mb_substr($string1, $i, 1, 'UTF-8');
146: for ($j = 0; $j < $length2; $j++) {
147: $char2 = mb_substr($string2, $j, 1, 'UTF-8');
148:
149: if ($char1 === $char2) {
150: $cost = 0;
151: } elseif ($replacementCaseCost !== null && self::lower($char1) === self::lower($char2)) {
152: $cost = $replacementCaseCost;
153: } elseif ($replacementAccentCost !== null && self::removeDiacritics($char1) === self::removeDiacritics($char2)) {
154: $cost = $replacementAccentCost;
155: } elseif ($replacementCaseCost !== null && $replacementAccentCost !== null && self::removeDiacriticsAndLower($char1) === self::removeDiacriticsAndLower($char2)) {
156: $cost = $replacementCaseCost + $replacementAccentCost;
157: } else {
158: $cost = $replacementCost;
159: }
160: $replacement = $previousRow[$j] + $cost;
161: $insertions = $previousRow[$j + 1] + $insertionCost;
162: $deletions = $currentRow[$j] + $deletionCost;
163:
164: $currentRow[] = min($replacement, $insertions, $deletions);
165: }
166: $previousRow = $currentRow;
167: }
168:
169: return $previousRow[$length2];
170: }
171:
172: public static function removeDiacritics(string $string): string
173: {
174: static $transliterator;
175: if ($transliterator === null) {
176: $transliterator = Transliterator::createFromIds([
177: Transliterator::DECOMPOSE,
178: [Transliterator::REMOVE, UnicodeCharacterCategory::NONSPACING_MARK],
179: Transliterator::COMPOSE,
180: ]);
181: }
182:
183: return $transliterator->transliterate($string);
184: }
185:
186: private static function removeDiacriticsAndLower(string $string): string
187: {
188: static $transliterator;
189: if ($transliterator === null) {
190: $transliterator = Transliterator::createFromIds([
191: Transliterator::DECOMPOSE,
192: [Transliterator::REMOVE, UnicodeCharacterCategory::NONSPACING_MARK],
193: Transliterator::COMPOSE,
194: Transliterator::LOWER_CASE,
195: ]);
196: }
197:
198: return $transliterator->transliterate($string);
199: }
200:
201: }
| 92 % | common\types\Type.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: // spell-check-ignore: suf
11:
12: namespace Dogma;
13:
14: use Dogma\Language\Encoding;
15: use Dogma\Language\Locale\Locale;
16:
17: /**
18: * Type metadata
19: */
20: class Type
21: {
22: use \Dogma\StrictBehaviorMixin;
23: use \Dogma\NonCloneableMixin;
24: use \Dogma\NonSerializableMixin;
25:
26: // types
27: public const BOOL = 'bool';
28: public const INT = 'int';
29: public const FLOAT = 'float';
30: public const STRING = 'string';
31: public const PHP_ARRAY = 'array';
32: public const OBJECT = 'object';
33: public const PHP_CALLABLE = 'callable';
34: public const RESOURCE = 'resource';
35:
36: // pseudotypes
37: public const NULL = 'null';
38: public const NUMBER = 'number';
39: public const SCALAR = 'scalar';
40: public const MIXED = 'mixed';
41: public const VOID = 'void';
42:
43: // strict type checks flag
44: public const STRICT = true;
45:
46: // nullable type flag
47: public const NULLABLE = true;
48: public const NOT_NULLABLE = false;
49:
50: /** @var \Dogma\Type[] (string $id => $type) */
51: private static $instances = [];
52:
53: /** @var string */
54: private $id;
55:
56: /** @var string */
57: private $type;
58:
59: /** @var \Dogma\Type|\Dogma\Type[]|null */
60: private $itemType;
61:
62: /** @var bool */
63: private $nullable = false;
64:
65: /** @var int|int[]|null */
66: private $size;
67:
68: /** @var string|null */
69: private $specific;
70:
71: /** @var \Dogma\Language\Encoding|null */
72: private $encoding;
73:
74: /** @var \Dogma\Language\Locale\Locale|null */
75: private $locale;
76:
77: /**
78: * @param string $id
79: * @param string $type
80: * @param bool $nullable
81: * @param \Dogma\Type|\Dogma\Type[]|null $itemType
82: * @param int|int[]|null $size
83: * @param string|null $specific
84: * @param \Dogma\Language\Encoding $encoding
85: * @param \Dogma\Language\Locale\Locale $locale
86: */
87: final private function __construct(
88: string $id,
89: string $type,
90: ?bool $nullable = null,
91: $itemType = null,
92: $size = null,
93: ?string $specific = null,
94: ?Encoding $encoding = null,
95: ?Locale $locale = null
96: ) {
97: $this->id = $id;
98: $this->type = $type;
99: $this->nullable = $nullable;
100: $this->itemType = $itemType;
101: $this->size = $size;
102: $this->specific = $specific;
103: $this->encoding = $encoding;
104: $this->locale = $locale;
105: }
106:
107: /**
108: * @param string $type
109: * @param int|int[]|null $size [optional]
110: * @param string|null $specific [optional]
111: * @param \Dogma\Language\Encoding|null $encoding [optional]
112: * @param \Dogma\Language\Locale\Locale|null $locale [optional]
113: * @param bool $nullable [optional]
114: * @return self
115: */
116: public static function get(string $type, $size = null, $specific = null, $encoding = null, $locale = null, ?bool $nullable = null): self
117: {
118: $args = func_get_args();
119: $size = $specific = $encoding = $locale = $nullable = null;
120: foreach ($args as $i => $arg) {
121: switch (true) {
122: case $i < 1:
123: break;
124: case $nullable === null && is_bool($arg):
125: $nullable = $arg;
126: break;
127: case $size === null && (is_int($arg) || is_array($arg)):
128: $size = $arg;
129: self::checkSize($type, $size);
130: break;
131: case $specific === null && (is_string($arg) || $arg instanceof ResourceType):
132: $specific = $arg instanceof ResourceType ? $arg->getValue() : $arg;
133: self::checkSpecific($type, $specific);
134: if ($specific === Sign::SIGNED) {
135: $specific = null;
136: }
137: break;
138: case $encoding === null && $arg instanceof Encoding:
139: $encoding = $arg;
140: break;
141: case $locale === null && $arg instanceof Locale:
142: $locale = $arg;
143: break;
144: case $arg === null:
145: continue;
146: default:
147: throw new \Dogma\InvalidArgumentException(sprintf(
148: 'Unexpected or duplicate argument %s at position %d.',
149: ExceptionValueFormatter::format($arg),
150: $i
151: ));
152: }
153: }
154:
155: if ($nullable === null) {
156: $nullable = false;
157: }
158:
159: // normalize "array" to "array<mixed>"
160: if ($type === self::PHP_ARRAY) {
161: return self::collectionOf(self::PHP_ARRAY, self::get(self::MIXED), $nullable);
162: }
163:
164: $id = $type;
165: if ($size !== null || $specific !== null || $encoding !== null || $locale !== null) {
166: $id .= '(' . implode(',', Arr::flatten(Arr::filter(
167: [$size, $specific, $encoding ? $encoding->getValue() : null, $locale ? $locale->getValue() : null]
168: ))) . ')';
169: }
170: if ($nullable) {
171: $id .= '?';
172: }
173: if (empty(self::$instances[$id])) {
174: $that = new self($id, $type, $nullable, null, $size, $specific, $encoding, $locale);
175: self::$instances[$id] = $that;
176: }
177:
178: return self::$instances[$id];
179: }
180:
181: private static function checkSize(string $type, ?int $size = null): void
182: {
183: if ($type === self::INT) {
184: BitSize::checkIntSize($size);
185: return;
186: } elseif ($type === self::FLOAT) {
187: BitSize::checkFloatSize($size);
188: return;
189: } elseif ($type === self::STRING && $size > 0) {
190: return;
191: }
192: throw new \Dogma\InvalidSizeException($type, $size, []);
193: }
194:
195: /**
196: * @param string $type
197: * @param mixed|null $specific
198: */
199: private static function checkSpecific(string $type, $specific = null): void
200: {
201: if ($type === self::INT && ($specific === Sign::SIGNED || $specific === Sign::UNSIGNED)) {
202: return;
203: }
204: if ($type === self::STRING && $specific === Length::FIXED) {
205: return;
206: }
207: if ($type === self::RESOURCE && ResourceType::isValid($specific)) {
208: return;
209: }
210: throw new \Dogma\InvalidTypeException($type, sprintf('%s(%s)', $type, $specific));
211: }
212:
213: public static function bool(bool $nullable = false): self
214: {
215: return self::get(self::BOOL, $nullable);
216: }
217:
218: /**
219: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
220: * @param int|null $size
221: * @param string|null $sign
222: * @param bool|null $nullable
223: * @return self
224: */
225: public static function int($size = null, $sign = null, ?bool $nullable = null): self
226: {
227: return self::get(self::INT, $size, $sign, $nullable);
228: }
229:
230: /**
231: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
232: * @param int|null $size
233: * @param bool|null $nullable
234: * @return self
235: */
236: public static function uint($size = null, ?bool $nullable = null): self
237: {
238: return self::get(self::INT, $size, Sign::UNSIGNED, $nullable);
239: }
240:
241: /**
242: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
243: * @param int|null $size
244: * @param bool|null $nullable
245: * @return self
246: */
247: public static function float($size = null, ?bool $nullable = null): self
248: {
249: return self::get(self::FLOAT, $size, $nullable);
250: }
251:
252: /**
253: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
254: * @param int|null $size
255: * @param string|null $fixed
256: * @param \Dogma\Language\Encoding|null $encoding
257: * @param \Dogma\Language\Locale\Locale|null $locale
258: * @param bool|null $nullable
259: * @return self
260: */
261: public static function string($size = null, $fixed = null, $encoding = null, $locale = null, ?bool $nullable = null): self
262: {
263: return self::get(self::STRING, $size, $fixed, $encoding, $locale, $nullable);
264: }
265:
266: public static function callable(?bool $nullable = null): self
267: {
268: return self::get(self::PHP_CALLABLE, $nullable);
269: }
270:
271: /**
272: * @param \Dogma\ResourceType|string|null $resourceType
273: * @param bool $nullable
274: * @return self
275: */
276: public static function resource($resourceType = null, ?bool $nullable = null): self
277: {
278: return self::get(self::RESOURCE, $resourceType, $nullable);
279: }
280:
281: /**
282: * @param string|self $itemType
283: * @param bool $nullable
284: * @return self
285: */
286: public static function arrayOf($itemType, ?bool $nullable = false): self
287: {
288: return self::collectionOf(self::PHP_ARRAY, $itemType, $nullable);
289: }
290:
291: /**
292: * @param string $type
293: * @param string|self $itemType
294: * @param bool $nullable
295: * @return self
296: */
297: public static function collectionOf(string $type, $itemType, ?bool $nullable = false): self
298: {
299: Check::types($itemType, [self::STRING, self::class]);
300:
301: if (!$itemType instanceof self) {
302: $itemType = self::get($itemType);
303: }
304:
305: $id = $type . '<' . $itemType->getId() . '>' . ($nullable ? '?' : '');
306: if (empty(self::$instances[$id])) {
307: $that = new self($id, $type, $nullable, $itemType);
308: self::$instances[$id] = $that;
309: }
310:
311: return self::$instances[$id];
312: }
313:
314: /**
315: * @param string|self ...$itemTypes
316: * @return self
317: */
318: public static function tupleOf(...$itemTypes): self
319: {
320: $nullable = false;
321: if (is_bool(end($itemTypes))) {
322: $nullable = array_pop($itemTypes);
323: }
324:
325: Check::itemsOfTypes($itemTypes, [self::STRING, self::class]);
326:
327: $itemIds = [];
328: foreach ($itemTypes as &$type) {
329: if (!$type instanceof self) {
330: $itemIds[] = $type;
331: $type = self::get($type);
332: } else {
333: $itemIds[] = $type->getId();
334: }
335: }
336:
337: $id = Tuple::class . '<' . implode(',', $itemIds) . '>' . ($nullable ? '?' : '');
338: if (empty(self::$instances[$id])) {
339: $that = new self($id, Tuple::class, $nullable, $itemTypes);
340: self::$instances[$id] = $that;
341: }
342:
343: return self::$instances[$id];
344: }
345:
346: /**
347: * Converts string in syntax like "Foo<Bar,Baz<int>>" to a Type instance
348: * @param string $id
349: * @return self
350: */
351: public static function fromId(string $id): self
352: {
353: if (isset(self::$instances[$id])) {
354: return self::$instances[$id];
355: }
356:
357: if (!preg_match('/^([^(<?]+)(?:\\(([^)]+)\\))?(?:<(.*)>)?(\\?)?$/', $id, $match)) {
358: throw new \Dogma\InvalidTypeDefinitionException($id);
359: }
360: $match = Arr::padTo($match, 5, false);
361: list(, $baseId, $params, $itemIds, $nullable) = $match;
362: $nullable = (bool) $nullable;
363:
364: $size = $specific = $encoding = $locale = null;
365: if ($params) {
366: foreach (explode(',', $params) as $param) {
367: switch (true) {
368: case $size === null && preg_match('/([0-9]+)?([suf])?/', $param, $match):
369: $size = (int) $match[1];
370: if ($size) {
371: self::checkSize($baseId, $size);
372: } else {
373: $size = null;
374: }
375: if (isset($match[2])) {
376: $specific = ['s' => Sign::SIGNED, 'u' => Sign::UNSIGNED, 'f' => Length::FIXED][$match[2]];
377: }
378: break;
379: case $specific === null && ($param === Sign::SIGNED || $param === Sign::UNSIGNED || $param === Length::FIXED || ResourceType::isValid($param)):
380: $specific = $param;
381: break;
382: case $encoding === null && preg_match('/^' . Encoding::getValueRegexp() . '$/', $param):
383: $encoding = Encoding::get($param);
384: break;
385: case $locale === null && preg_match('/^' . Locale::getValueRegexp() . '$/', $param):
386: $locale = Locale::get($param);
387: break;
388: default:
389: throw new \Dogma\InvalidTypeDefinitionException($id);
390: }
391: }
392: if ($specific) {
393: self::checkSpecific($baseId, $specific);
394: }
395: }
396:
397: if (!$itemIds) {
398: return self::get($baseId, $size, $specific, $encoding, $locale, $nullable);
399: }
400:
401: $itemIds = preg_split('/(?<![0-9]),/', $itemIds);
402: $last = 0;
403: $counter = 0;
404: foreach ($itemIds as $i => $type) {
405: $carry = strlen($type) - strlen(str_replace(['<', '>'], ['', ' '], $type));
406: if ($counter === 0 && $carry > 0) {
407: $last = $i;
408: } elseif ($counter > 0) {
409: unset($itemIds[$i]);
410: $itemIds[$last] .= ',' . $type;
411: }
412: $counter += $carry;
413: }
414:
415: $itemTypes = [];
416: foreach ($itemIds as $id) {
417: $itemTypes[] = self::fromId($id);
418: }
419:
420: if ($baseId === Tuple::class) {
421: if ($nullable) {
422: $itemTypes[] = $nullable;
423: }
424: return self::tupleOf(...$itemTypes);
425: } else {
426: if (count($itemTypes) !== 1) {
427: throw new \Dogma\InvalidTypeDefinitionException($id);
428: }
429: if ($baseId === self::PHP_ARRAY) {
430: return self::arrayOf($itemTypes[0], $nullable);
431: } else {
432: return self::collectionOf($baseId, $itemTypes[0], $nullable);
433: }
434: }
435: }
436:
437: public function getId(): string
438: {
439: return $this->id;
440: }
441:
442: public function getName(): string
443: {
444: return $this->type;
445: }
446:
447: public function isNullable(): bool
448: {
449: return $this->nullable;
450: }
451:
452: public function isSigned(): bool
453: {
454: return $this->type === self::INT && $this->specific === null;
455: }
456:
457: public function isUnsigned(): bool
458: {
459: return $this->specific === Sign::UNSIGNED;
460: }
461:
462: public function isFixed(): bool
463: {
464: return $this->specific === Length::FIXED;
465: }
466:
467: public function getResourceType(): ?ResourceType
468: {
469: return $this->type === self::RESOURCE && $this->specific ? ResourceType::get($this->specific) : null;
470: }
471:
472: /**
473: * Returns type of items or array of types for Tuple
474: * @return self|self[]|null
475: */
476: public function getItemType()
477: {
478: return $this->itemType;
479: }
480:
481: /**
482: * Returns bit-size for numeric types and length for string
483: */
484: public function getSize(): ?int
485: {
486: return $this->size;
487: }
488:
489: public function getEncoding(): ?Encoding
490: {
491: return $this->encoding;
492: }
493:
494: public function getLocale(): ?Locale
495: {
496: return $this->locale;
497: }
498:
499: public function isBool(): bool
500: {
501: return $this->type === self::BOOL;
502: }
503:
504: public function isInt(): bool
505: {
506: return $this->type === self::INT;
507: }
508:
509: public function isFloat(): bool
510: {
511: return $this->type === self::FLOAT;
512: }
513:
514: public function isNumeric(): bool
515: {
516: return $this->type === self::INT || $this->type === self::FLOAT || $this->type === self::NUMBER;
517: }
518:
519: public function isString(): bool
520: {
521: return $this->type === self::STRING;
522: }
523:
524: public function isScalar(): bool
525: {
526: return in_array($this->type, self::listScalarTypes());
527: }
528:
529: public function isArray(): bool
530: {
531: return $this->type === self::PHP_ARRAY;
532: }
533:
534: public function isCollection(): bool
535: {
536: return $this->itemType && $this->type !== self::PHP_ARRAY && $this->type !== Tuple::class;
537: }
538:
539: public function isTuple(): bool
540: {
541: return $this->type === Tuple::class;
542: }
543:
544: public function isClass(): bool
545: {
546: return !in_array($this->type, self::listTypes());
547: }
548:
549: public function isCallable(): bool
550: {
551: return $this->type === self::PHP_CALLABLE;
552: }
553:
554: public function isResource(): bool
555: {
556: return $this->type === self::RESOURCE;
557: }
558:
559: public function is(string $typeName): bool
560: {
561: return $this->type === $typeName;
562: }
563:
564: public function isImplementing(string $interfaceName): bool
565: {
566: return $this->type === $interfaceName || is_subclass_of($this->type, $interfaceName);
567: }
568:
569: /**
570: * Returns base of the type (without nullable, items and parameters)
571: */
572: public function getBaseType(): self
573: {
574: return self::get($this->type);
575: }
576:
577: /**
578: * Returns non-nullable version of self
579: */
580: public function getNonNullableType(): self
581: {
582: switch (true) {
583: case !$this->nullable:
584: return $this;
585: case $this->isArray():
586: case $this->isCollection():
587: return self::collectionOf($this->type, $this->itemType);
588: case $this->isTuple():
589: return self::tupleOf(...$this->itemType);
590: default:
591: return self::get($this->type, $this->size, $this->specific, $this->encoding, $this->locale);
592: }
593: }
594:
595: /**
596: * Returns type without size, sign, encoding etc.
597: */
598: public function getTypeWithoutParams(): self
599: {
600: switch (true) {
601: case $this->isArray():
602: case $this->isCollection():
603: return self::collectionOf($this->type, $this->itemType->getTypeWithoutParams(), $this->nullable);
604: case $this->isTuple():
605: $itemTypes = [];
606: foreach ($this->itemType as $itemType) {
607: $itemTypes[] = $itemType->getTypeWithoutParams();
608: }
609: if ($this->nullable) {
610: $itemTypes[] = $this->nullable;
611: }
612: return self::tupleOf(...$itemTypes);
613: default:
614: return self::get($this->type, $this->nullable);
615: }
616: }
617:
618: /**
619: * Returns new instance of type. Works only on simple class types with public constructor.
620: * @param mixed ...$arguments
621: * @return object
622: */
623: public function getInstance(...$arguments): object
624: {
625: $className = $this->type;
626:
627: return new $className(...$arguments);
628: }
629:
630: /**
631: * List of types and pseudotypes, that can be used in annotations. Does not include 'null' and 'void'
632: * @return string[]
633: */
634: public static function listTypes(): array
635: {
636: return [
637: self::BOOL,
638: self::INT,
639: self::FLOAT,
640: self::NUMBER,
641: self::STRING,
642: self::SCALAR,
643: self::MIXED,
644: self::PHP_ARRAY,
645: self::OBJECT,
646: self::PHP_CALLABLE,
647: self::RESOURCE,
648: ];
649: }
650:
651: /**
652: * List of native PHP types. Does not include 'null'.
653: * @return string[]
654: */
655: public static function listNativeTypes(): array
656: {
657: return [
658: self::BOOL,
659: self::INT,
660: self::FLOAT,
661: self::STRING,
662: self::PHP_ARRAY,
663: self::OBJECT,
664: self::PHP_CALLABLE,
665: self::RESOURCE,
666: ];
667: }
668:
669: /**
670: * List of native PHP scalar types and pseudotype 'numeric'.
671: * @return string[]
672: */
673: public static function listScalarTypes(): array
674: {
675: return [
676: self::BOOL,
677: self::INT,
678: self::FLOAT,
679: self::NUMBER,
680: self::STRING,
681: ];
682: }
683:
684: public static function isType(string $type): bool
685: {
686: try {
687: self::fromId($type);
688: return true;
689: } catch (\Throwable $t) {
690: return false;
691: }
692: }
693:
694: /**
695: * @return self[]
696: */
697: public static function getDefinedTypes(): array
698: {
699: return self::$instances;
700: }
701:
702: }
| 44 % | Country\Country.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Country;
11:
12: /**
13: * 2-letter country code by ISO-3166-1
14: */
15: class Country extends \Dogma\Enum\StringEnum
16: {
17:
18: public const AFGHANISTAN = 'AF';
19: public const ALAND_ISLANDS = 'AX';
20: public const ALBANIA = 'AL';
21: public const ALGERIA = 'DZ';
22: public const AMERICAN_SAMOA = 'AS';
23: public const ANDORRA = 'AD';
24: public const ANGOLA = 'AO';
25: public const ANGUILLA = 'AI';
26: public const ANTARCTICA = 'AQ';
27: public const ANTIGUA_AND_BARBUDA = 'AG';
28: public const ARGENTINA = 'AR';
29: public const ARMENIA = 'AM';
30: public const ARUBA = 'AW';
31: public const AUSTRALIA = 'AU';
32: public const AUSTRIA = 'AT';
33: public const AZERBAIJAN = 'AZ';
34: public const BAHAMAS = 'BS';
35: public const BAHRAIN = 'BH';
36: public const BANGLADESH = 'BD';
37: public const BARBADOS = 'BB';
38: public const BELARUS = 'BY';
39: public const BELGIUM = 'BE';
40: public const BELIZE = 'BZ';
41: public const BENIN = 'BJ';
42: public const BERMUDA = 'BM';
43: public const BHUTAN = 'BT';
44: public const BOLIVIA = 'BO';
45: public const BOSNIA_AND_HERZEGOVINA = 'BA';
46: public const BOTSWANA = 'BW';
47: public const BOUVET_ISLAND = 'BV';
48: public const BRAZIL = 'BR';
49: public const BRITISH_INDIAN_OCEAN_TERRITORY = 'IO';
50: public const BRUNEI_DARUSSALAM = 'BN';
51: public const BULGARIA = 'BG';
52: public const BURKINA_FASO = 'BF';
53: public const BURUNDI = 'BI';
54: public const CAMBODIA = 'KH';
55: public const CAMEROON = 'CM';
56: public const CANADA = 'CA';
57: public const CAPE_VERDE = 'CV';
58: public const CAYMAN_ISLANDS = 'KY';
59: public const CENTRAL_AFRICAN_REPUBLIC = 'CF';
60: public const CHAD = 'TD';
61: public const CHILE = 'CL';
62: public const CHINA = 'CN';
63: public const CHRISTMAS_ISLAND = 'CX';
64: public const COCOS_ISLANDS = 'CC';
65: public const COLOMBIA = 'CO';
66: public const COMOROS = 'KM';
67: public const CONGO = 'CG';
68: public const COOK_ISLANDS = 'CK';
69: public const COSTA_RICA = 'CR';
70: public const COTE_D_IVOIRE = 'CI';
71: public const CROATIA = 'HR';
72: public const CUBA = 'CU';
73: public const CYPRUS = 'CY';
74: public const CZECHIA = 'CZ';
75: public const DEMOCRATIC_REPUBLIC_OF_THE_CONGO = 'CD';
76: public const DENMARK = 'DK';
77: public const DJIBOUTI = 'DJ';
78: public const DOMINICA = 'DM';
79: public const DOMINICAN_REPUBLIC = 'DO';
80: public const ECUADOR = 'EC';
81: public const EGYPT = 'EG';
82: public const EL_SALVADOR = 'SV';
83: public const EQUATORIAL_GUINEA = 'GQ';
84: public const ERITREA = 'ER';
85: public const ESTONIA = 'EE';
86: public const ETHIOPIA = 'ET';
87: public const FALKLAND_ISLANDS = 'FK';
88: public const FAROE_ISLANDS = 'FO';
89: public const FIJI = 'FJ';
90: public const FINLAND = 'FI';
91: public const FRANCE = 'FR';
92: public const FRENCH_GUIANA = 'GF';
93: public const FRENCH_POLYNESIA = 'PF';
94: public const FRENCH_SOUTHERN_TERRITORIES = 'TF';
95: public const GABON = 'GA';
96: public const GAMBIA = 'GM';
97: public const GEORGIA = 'GE';
98: public const GERMANY = 'DE';
99: public const GHANA = 'GH';
100: public const GIBRALTAR = 'GI';
101: public const GREECE = 'GR';
102: public const GREENLAND = 'GL';
103: public const GRENADA = 'GD';
104: public const GUADELOUPE = 'GP';
105: public const GUAM = 'GU';
106: public const GUATEMALA = 'GT';
107: public const GUERNSEY = 'GG';
108: public const GUINEA = 'GN';
109: public const GUINEA_BISSAU = 'GW';
110: public const GUYANA = 'GY';
111: public const HAITI = 'HT';
112: public const HEARD_ISLAND_AND_MCDONALD_ISLANDS = 'HM';
113: public const HONDURAS = 'HN';
114: public const HONG_KONG = 'HK';
115: public const HUNGARY = 'HU';
116: public const ICELAND = 'IS';
117: public const INDIA = 'IN';
118: public const INDONESIA = 'ID';
119: public const IRAQ = 'IQ';
120: public const IRELAND = 'IE';
121: public const ISLAMIC_REPUBLIC_OF_IRAN = 'IR';
122: public const ISLE_OF_MAN = 'IM';
123: public const ISRAEL = 'IL';
124: public const ITALY = 'IT';
125: public const JAMAICA = 'JM';
126: public const JAPAN = 'JP';
127: public const JERSEY = 'JE';
128: public const JORDAN = 'JO';
129: public const KAZAKHSTAN = 'KZ';
130: public const KENYA = 'KE';
131: public const KIRIBATI = 'KI';
132: public const KOSOVO = 'XK';
133: public const KUWAIT = 'KW';
134: public const KYRGYZSTAN = 'KG';
135: public const LAOS = 'LA';
136: public const LATVIA = 'LV';
137: public const LEBANON = 'LB';
138: public const LESOTHO = 'LS';
139: public const LIBERIA = 'LR';
140: public const LIBYA = 'LY';
141: public const LIECHTENSTEIN = 'LI';
142: public const LITHUANIA = 'LT';
143: public const LUXEMBOURG = 'LU';
144: public const MACAO = 'MO';
145: public const MACEDONIA = 'MK';
146: public const MADAGASCAR = 'MG';
147: public const MALAWI = 'MW';
148: public const MALAYSIA = 'MY';
149: public const MALDIVES = 'MV';
150: public const MALI = 'ML';
151: public const MALTA = 'MT';
152: public const MARSHALL_ISLANDS = 'MH';
153: public const MARTINIQUE = 'MQ';
154: public const MAURITANIA = 'MR';
155: public const MAURITIUS = 'MU';
156: public const MAYOTTE = 'YT';
157: public const MEXICO = 'MX';
158: public const MICRONESIA = 'FM';
159: public const MOLDOVA = 'MD';
160: public const MONACO = 'MC';
161: public const MONGOLIA = 'MN';
162: public const MONTENEGRO = 'ME';
163: public const MONTSERRAT = 'MS';
164: public const MOROCCO = 'MA';
165: public const MOZAMBIQUE = 'MZ';
166: public const MYANMAR = 'MM';
167: public const NAMIBIA = 'NA';
168: public const NAURU = 'NR';
169: public const NEPAL = 'NP';
170: public const NETHERLANDS = 'NL';
171: public const NETHERLANDS_ANTILLES = 'AN';
172: public const NEW_CALEDONIA = 'NC';
173: public const NEW_ZEALAND = 'NZ';
174: public const NICARAGUA = 'NI';
175: public const NIGER = 'NE';
176: public const NIGERIA = 'NG';
177: public const NIUE = 'NU';
178: public const NORFOLK_ISLAND = 'NF';
179: public const NORTHERN_MARIANA_ISLANDS = 'MP';
180: public const NORTH_KOREA = 'KP';
181: public const NORWAY = 'NO';
182: public const OMAN = 'OM';
183: public const PAKISTAN = 'PK';
184: public const PALAU = 'PW';
185: public const PALESTINE = 'PS';
186: public const PANAMA = 'PA';
187: public const PAPUA_NEW_GUINEA = 'PG';
188: public const PARAGUAY = 'PY';
189: public const PERU = 'PE';
190: public const PHILIPPINES = 'PH';
191: public const PITCAIRN = 'PN';
192: public const POLAND = 'PL';
193: public const PORTUGAL = 'PT';
194: public const PUERTO_RICO = 'PR';
195: public const QATAR = 'QA';
196: public const REUNION = 'RE';
197: public const ROMANIA = 'RO';
198: public const RUSSIA = 'RU';
199: public const RWANDA = 'RW';
200: public const SAINT_HELENA = 'SH';
201: public const SAINT_KITTS_AND_NEVIS = 'KN';
202: public const SAINT_LUCIA = 'LC';
203: public const SAINT_MARTIN_DUTCH = 'SX';
204: public const SAINT_MARTIN_FRENCH = 'MF';
205: public const SAINT_PIERRE_AND_MIQUELON = 'PM';
206: public const SAINT_VINCENT_AND_THE_GRENADINES = 'VC';
207: public const SAMOA = 'WS';
208: public const SAN_MARINO = 'SM';
209: public const SAO_TOME_AND_PRINCIPE = 'ST';
210: public const SAUDI_ARABIA = 'SA';
211: public const SENEGAL = 'SN';
212: public const SERBIA = 'RS';
213: public const SEYCHELLES = 'SC';
214: public const SIERRA_LEONE = 'SL';
215: public const SINGAPORE = 'SG';
216: public const SLOVAKIA = 'SK';
217: public const SLOVENIA = 'SI';
218: public const SOLOMON_ISLANDS = 'SB';
219: public const SOMALIA = 'SO';
220: public const SOUTH_AFRICA = 'ZA';
221: public const SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH = 'GS';
222: public const SOUTH_KOREA = 'KR';
223: public const SOUTH_SUDAN = 'SS';
224: public const SPAIN = 'ES';
225: public const SRI_LANKA = 'LK';
226: public const SUDAN = 'SD';
227: public const SURINAME = 'SR';
228: public const SVALBARD_AND_JAN_MAYEN = 'SJ';
229: public const SWAZILAND = 'SZ';
230: public const SWEDEN = 'SE';
231: public const SWITZERLAND = 'CH';
232: public const SYRIA = 'SY';
233: public const TAIWAN = 'TW';
234: public const TAJIKISTAN = 'TJ';
235: public const TANZANIA = 'TZ';
236: public const THAILAND = 'TH';
237: public const TIMOR_LESTE = 'TL';
238: public const TOGO = 'TG';
239: public const TOKELAU = 'TK';
240: public const TONGA = 'TO';
241: public const TRINIDAD_AND_TOBAGO = 'TT';
242: public const TUNISIA = 'TN';
243: public const TURKEY = 'TR';
244: public const TURKMENISTAN = 'TM';
245: public const TURKS_AND_CAICOS_ISLANDS = 'TC';
246: public const TUVALU = 'TV';
247: public const UGANDA = 'UG';
248: public const UKRAINE = 'UA';
249: public const UNITED_ARAB_EMIRATES = 'AE';
250: public const UNITED_KINGDOM = 'GB';
251: public const UNITED_STATES = 'US';
252: public const UNITED_STATES_MINOR_OUTLYING_ISLANDS = 'UM';
253: public const URUGUAY = 'UY';
254: public const UZBEKISTAN = 'UZ';
255: public const VANUATU = 'VU';
256: public const VATICAN = 'VA';
257: public const VENEZUELA = 'VE';
258: public const VIETNAM = 'VN';
259: public const VIRGIN_ISLANDS_BRITISH = 'VG';
260: public const VIRGIN_ISLANDS_US = 'VI';
261: public const WALLIS_AND_FUTUNA = 'WF';
262: public const WESTERN_SAHARA = 'EH';
263: public const YEMEN = 'YE';
264: public const ZAMBIA = 'ZM';
265: public const ZIMBABWE = 'ZW';
266:
267: /**
268: * @var string[]
269: */
270: private static $names = [
271: self::AFGHANISTAN => 'Afghanistan',
272: self::ALAND_ISLANDS => 'Aland Islands',
273: self::ALBANIA => 'Albania',
274: self::ALGERIA => 'Algeria',
275: self::AMERICAN_SAMOA => 'American Samoa',
276: self::ANDORRA => 'Andorra',
277: self::ANGOLA => 'Angola',
278: self::ANGUILLA => 'Anguilla',
279: self::ANTARCTICA => 'Antarctica',
280: self::ANTIGUA_AND_BARBUDA => 'Antigua and Barbuda',
281: self::ARGENTINA => 'Argentina',
282: self::ARMENIA => 'Armenia',
283: self::ARUBA => 'Aruba',
284: self::AUSTRALIA => 'Australia',
285: self::AUSTRIA => 'Austria',
286: self::AZERBAIJAN => 'Azerbaijan',
287: self::BAHAMAS => 'Bahamas',
288: self::BAHRAIN => 'Bahrain',
289: self::BANGLADESH => 'Bangladesh',
290: self::BARBADOS => 'Barbados',
291: self::BELARUS => 'Belarus',
292: self::BELGIUM => 'Belgium',
293: self::BELIZE => 'Belize',
294: self::BENIN => 'Benin',
295: self::BERMUDA => 'Bermuda',
296: self::BHUTAN => 'Bhutan',
297: self::BOLIVIA => 'Bolivia',
298: self::BOSNIA_AND_HERZEGOVINA => 'Bosnia and Herzegovina',
299: self::BOTSWANA => 'Botswana',
300: self::BOUVET_ISLAND => 'Bouvet Island',
301: self::BRAZIL => 'Brazil',
302: self::BRITISH_INDIAN_OCEAN_TERRITORY => 'British Indian Ocean Territory',
303: self::BRUNEI_DARUSSALAM => 'Brunei Darussalam',
304: self::BULGARIA => 'Bulgaria',
305: self::BURKINA_FASO => 'Burkina Faso',
306: self::BURUNDI => 'Burundi',
307: self::CAMBODIA => 'Cambodia',
308: self::CAMEROON => 'Cameroon',
309: self::CANADA => 'Canada',
310: self::CAPE_VERDE => 'Cape Verde',
311: self::CAYMAN_ISLANDS => 'Cayman Islands',
312: self::CENTRAL_AFRICAN_REPUBLIC => 'Central African Republic',
313: self::CHAD => 'Chad',
314: self::CHILE => 'Chile',
315: self::CHINA => 'China',
316: self::CHRISTMAS_ISLAND => 'Christmas Island',
317: self::COCOS_ISLANDS => 'Cocos (Keeling) Islands',
318: self::COLOMBIA => 'Colombia',
319: self::COMOROS => 'Comoros',
320: self::CONGO => 'Congo',
321: self::COOK_ISLANDS => 'Cook Islands',
322: self::COSTA_RICA => 'Costa Rica',
323: self::COTE_D_IVOIRE => 'Cóte d\'Ivoire',
324: self::CROATIA => 'Croatia',
325: self::CUBA => 'Cuba',
326: self::CYPRUS => 'Cyprus',
327: self::CZECHIA => 'Czechia',
328: self::DEMOCRATIC_REPUBLIC_OF_THE_CONGO => 'Congo, Democratic Republic of the',
329: self::DENMARK => 'Denmark',
330: self::DJIBOUTI => 'Djibouti',
331: self::DOMINICA => 'Dominica',
332: self::DOMINICAN_REPUBLIC => 'Dominican Republic',
333: self::ECUADOR => 'Ecuador',
334: self::EGYPT => 'Egypt',
335: self::EL_SALVADOR => 'El Salvador',
336: self::EQUATORIAL_GUINEA => 'Equatorial Guinea',
337: self::ERITREA => 'Eritrea',
338: self::ESTONIA => 'Estonia',
339: self::ETHIOPIA => 'Ethiopia',
340: self::FALKLAND_ISLANDS => 'Falkland Islands (Malvinas)',
341: self::FAROE_ISLANDS => 'Faroe Islands',
342: self::FIJI => 'Fiji',
343: self::FINLAND => 'Finland',
344: self::FRANCE => 'France',
345: self::FRENCH_GUIANA => 'French Guiana',
346: self::FRENCH_POLYNESIA => 'French Polynesia',
347: self::FRENCH_SOUTHERN_TERRITORIES => 'French Southern Territories',
348: self::GABON => 'Gabon',
349: self::GAMBIA => 'Gambia',
350: self::GEORGIA => 'Georgia',
351: self::GERMANY => 'Germany',
352: self::GHANA => 'Ghana',
353: self::GIBRALTAR => 'Gibraltar',
354: self::GREECE => 'Greece',
355: self::GREENLAND => 'Greenland',
356: self::GRENADA => 'Grenada',
357: self::GUADELOUPE => 'Guadeloupe',
358: self::GUAM => 'Guam',
359: self::GUATEMALA => 'Guatemala',
360: self::GUERNSEY => 'Guernsey',
361: self::GUINEA => 'Guinea',
362: self::GUINEA_BISSAU => 'Guinea-Bissau',
363: self::GUYANA => 'Guyana',
364: self::HAITI => 'Haiti',
365: self::HEARD_ISLAND_AND_MCDONALD_ISLANDS => 'Heard Island and McDonald Islands',
366: self::HONDURAS => 'Honduras',
367: self::HONG_KONG => 'Hong Kong',
368: self::HUNGARY => 'Hungary',
369: self::ICELAND => 'Iceland',
370: self::INDIA => 'India',
371: self::INDONESIA => 'Indonesia',
372: self::IRAQ => 'Iraq',
373: self::IRELAND => 'Ireland',
374: self::ISLAMIC_REPUBLIC_OF_IRAN => 'Iran, Islamic Republic of',
375: self::ISLE_OF_MAN => 'Isle of Man',
376: self::ISRAEL => 'Israel',
377: self::ITALY => 'Italy',
378: self::JAMAICA => 'Jamaica',
379: self::JAPAN => 'Japan',
380: self::JERSEY => 'Jersey',
381: self::JORDAN => 'Jordan',
382: self::KAZAKHSTAN => 'Kazakhstan',
383: self::KENYA => 'Kenya',
384: self::KIRIBATI => 'Kiribati',
385: self::KOSOVO => 'Kosovo',
386: self::KUWAIT => 'Kuwait',
387: self::KYRGYZSTAN => 'Kyrgyzstan',
388: self::LAOS => 'Laos',
389: self::LATVIA => 'Latvia',
390: self::LEBANON => 'Lebanon',
391: self::LESOTHO => 'Lesotho',
392: self::LIBERIA => 'Liberia',
393: self::LIBYA => 'Libya',
394: self::LIECHTENSTEIN => 'Liechtenstein',
395: self::LITHUANIA => 'Lithuania',
396: self::LUXEMBOURG => 'Luxembourg',
397: self::MACAO => 'Macao',
398: self::MACEDONIA => 'Macedonia',
399: self::MADAGASCAR => 'Madagascar',
400: self::MALAWI => 'Malawi',
401: self::MALAYSIA => 'Malaysia',
402: self::MALDIVES => 'Maldives',
403: self::MALI => 'Mali',
404: self::MALTA => 'Malta',
405: self::MARSHALL_ISLANDS => 'Marshall Islands',
406: self::MARTINIQUE => 'Martinique',
407: self::MAURITANIA => 'Mauritania',
408: self::MAURITIUS => 'Mauritius',
409: self::MAYOTTE => 'Mayotte',
410: self::MEXICO => 'Mexico',
411: self::MICRONESIA => 'Micronesia',
412: self::MOLDOVA => 'Moldova',
413: self::MONACO => 'Monaco',
414: self::MONGOLIA => 'Mongolia',
415: self::MONTENEGRO => 'Montenegro',
416: self::MONTSERRAT => 'Montserrat',
417: self::MOROCCO => 'Morocco',
418: self::MOZAMBIQUE => 'Mozambique',
419: self::MYANMAR => 'Myanmar',
420: self::NAMIBIA => 'Namibia',
421: self::NAURU => 'Nauru',
422: self::NEPAL => 'Nepal',
423: self::NETHERLANDS => 'Netherlands',
424: self::NETHERLANDS_ANTILLES => 'Netherlands Antilles',
425: self::NEW_CALEDONIA => 'New Caledonia',
426: self::NEW_ZEALAND => 'New Zealand',
427: self::NICARAGUA => 'Nicaragua',
428: self::NIGER => 'Niger',
429: self::NIGERIA => 'Nigeria',
430: self::NIUE => 'Niue',
431: self::NORFOLK_ISLAND => 'Norfolk Island',
432: self::NORTHERN_MARIANA_ISLANDS => 'Northern Mariana Islands',
433: self::NORTH_KOREA => 'North Korea',
434: self::NORWAY => 'Norway',
435: self::OMAN => 'Oman',
436: self::PAKISTAN => 'Pakistan',
437: self::PALAU => 'Palau',
438: self::PALESTINE => 'Palestine',
439: self::PANAMA => 'Panama',
440: self::PAPUA_NEW_GUINEA => 'Papua New Guinea',
441: self::PARAGUAY => 'Paraguay',
442: self::PERU => 'Peru',
443: self::PHILIPPINES => 'Philippines',
444: self::PITCAIRN => 'Pitcairn',
445: self::POLAND => 'Poland',
446: self::PORTUGAL => 'Portugal',
447: self::PUERTO_RICO => 'Puerto Rico',
448: self::QATAR => 'Qatar',
449: self::REUNION => 'Réunion',
450: self::ROMANIA => 'Romania',
451: self::RUSSIA => 'Russia',
452: self::RWANDA => 'Rwanda',
453: self::SAINT_HELENA => 'Saint Helena',
454: self::SAINT_KITTS_AND_NEVIS => 'Saint Kitts and Nevis',
455: self::SAINT_LUCIA => 'Saint Lucia',
456: self::SAINT_MARTIN_DUTCH => 'Saint Martin (Dutch)',
457: self::SAINT_MARTIN_FRENCH => 'Saint Martin (French)',
458: self::SAINT_PIERRE_AND_MIQUELON => 'Saint Pierre and Miquelon',
459: self::SAINT_VINCENT_AND_THE_GRENADINES => 'Saint Vincent and the Grenadines',
460: self::SAMOA => 'Samoa',
461: self::SAN_MARINO => 'San Marino',
462: self::SAO_TOME_AND_PRINCIPE => 'Sao Tome and Principe',
463: self::SAUDI_ARABIA => 'Saudi Arabia',
464: self::SENEGAL => 'Senegal',
465: self::SERBIA => 'Serbia',
466: self::SEYCHELLES => 'Seychelles',
467: self::SIERRA_LEONE => 'Sierra Leone',
468: self::SINGAPORE => 'Singapore',
469: self::SLOVAKIA => 'Slovakia',
470: self::SLOVENIA => 'Slovenia',
471: self::SOLOMON_ISLANDS => 'Solomon Islands',
472: self::SOMALIA => 'Somalia',
473: self::SOUTH_AFRICA => 'South Africa',
474: self::SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH => 'South Georgia and the South Sandwich',
475: self::SOUTH_KOREA => 'South Korea',
476: self::SOUTH_SUDAN => 'South Sudan',
477: self::SPAIN => 'Spain',
478: self::SRI_LANKA => 'Sri Lanka',
479: self::SUDAN => 'Sudan',
480: self::SURINAME => 'Suriname',
481: self::SVALBARD_AND_JAN_MAYEN => 'Svalbard and Jan Mayen',
482: self::SWAZILAND => 'Swaziland',
483: self::SWEDEN => 'Sweden',
484: self::SWITZERLAND => 'Switzerland',
485: self::SYRIA => 'Syria',
486: self::TAIWAN => 'Taiwan',
487: self::TAJIKISTAN => 'Tajikistan',
488: self::TANZANIA => 'Tanzania',
489: self::THAILAND => 'Thailand',
490: self::TIMOR_LESTE => 'Timor-Leste',
491: self::TOGO => 'Togo',
492: self::TOKELAU => 'Tokelau',
493: self::TONGA => 'Tonga',
494: self::TRINIDAD_AND_TOBAGO => 'Trinidad and Tobago',
495: self::TUNISIA => 'Tunisia',
496: self::TURKEY => 'Turkey',
497: self::TURKMENISTAN => 'Turkmenistan',
498: self::TURKS_AND_CAICOS_ISLANDS => 'Turks and Caicos Islands',
499: self::TUVALU => 'Tuvalu',
500: self::UGANDA => 'Uganda',
501: self::UKRAINE => 'Ukraine',
502: self::UNITED_ARAB_EMIRATES => 'United Arab Emirates',
503: self::UNITED_KINGDOM => 'United Kingdom',
504: self::UNITED_STATES => 'United States',
505: self::UNITED_STATES_MINOR_OUTLYING_ISLANDS => 'United States Minor Outlying Islands',
506: self::URUGUAY => 'Uruguay',
507: self::UZBEKISTAN => 'Uzbekistan',
508: self::VANUATU => 'Vanuatu',
509: self::VATICAN => 'Vatican',
510: self::VENEZUELA => 'Venezuela',
511: self::VIETNAM => 'Vietnam',
512: self::VIRGIN_ISLANDS_BRITISH => 'Virgin Islands, British',
513: self::VIRGIN_ISLANDS_US => 'Virgin Islands, U.S.',
514: self::WALLIS_AND_FUTUNA => 'Wallis and Futuna',
515: self::WESTERN_SAHARA => 'Western Sahara',
516: self::YEMEN => 'Yemen',
517: self::ZAMBIA => 'Zambia',
518: self::ZIMBABWE => 'Zimbabwe',
519: ];
520:
521: /**
522: * @var string[]
523: */
524: private static $idents = [
525: self::ANDORRA => 'andorra',
526: self::UNITED_ARAB_EMIRATES => 'united-arab-emirates',
527: self::AFGHANISTAN => 'afghanistan',
528: self::ANTIGUA_AND_BARBUDA => 'antigua-and-barbuda',
529: self::ANGUILLA => 'anguilla',
530: self::ALBANIA => 'albania',
531: self::ARMENIA => 'armenia',
532: self::NETHERLANDS_ANTILLES => 'netherlands-antilles',
533: self::ANGOLA => 'angola',
534: self::ANTARCTICA => 'antarctica',
535: self::ARGENTINA => 'argentina',
536: self::AMERICAN_SAMOA => 'american-samoa',
537: self::AUSTRIA => 'austria',
538: self::AUSTRALIA => 'australia',
539: self::ARUBA => 'aruba',
540: self::ALAND_ISLANDS => 'aland-islands',
541: self::AZERBAIJAN => 'azerbaijan',
542: self::BOSNIA_AND_HERZEGOVINA => 'bosnia-and-herzegovina',
543: self::BARBADOS => 'barbados',
544: self::BANGLADESH => 'bangladesh',
545: self::BELGIUM => 'belgium',
546: self::BURKINA_FASO => 'burkina-faso',
547: self::BULGARIA => 'bulgaria',
548: self::BAHRAIN => 'bahrain',
549: self::BURUNDI => 'burundi',
550: self::BENIN => 'benin',
551: self::BERMUDA => 'bermuda',
552: self::BRUNEI_DARUSSALAM => 'brunei-darussalam',
553: self::BOLIVIA => 'bolivia',
554: self::BRAZIL => 'brazil',
555: self::BAHAMAS => 'bahamas',
556: self::BHUTAN => 'bhutan',
557: self::BOUVET_ISLAND => 'bouvet-island',
558: self::BOTSWANA => 'botswana',
559: self::BELARUS => 'belarus',
560: self::BELIZE => 'belize',
561: self::CANADA => 'canada',
562: self::COCOS_ISLANDS => 'cocos-islands',
563: self::DEMOCRATIC_REPUBLIC_OF_THE_CONGO => 'democratic-republic-of-the-congo',
564: self::CENTRAL_AFRICAN_REPUBLIC => 'central-african-republic',
565: self::CONGO => 'congo',
566: self::SWITZERLAND => 'switzerland',
567: self::COTE_D_IVOIRE => 'cote-d-ivoire',
568: self::COOK_ISLANDS => 'cook-islands',
569: self::CHILE => 'chile',
570: self::CAMEROON => 'cameroon',
571: self::CHINA => 'china',
572: self::COLOMBIA => 'colombia',
573: self::COSTA_RICA => 'costa-rica',
574: self::CUBA => 'cuba',
575: self::CAPE_VERDE => 'cape-verde',
576: self::CHRISTMAS_ISLAND => 'christmas-island',
577: self::CYPRUS => 'cyprus',
578: self::CZECHIA => 'czechia',
579: self::GERMANY => 'germany',
580: self::DJIBOUTI => 'djibouti',
581: self::DENMARK => 'denmark',
582: self::DOMINICA => 'dominica',
583: self::DOMINICAN_REPUBLIC => 'dominican-republic',
584: self::ALGERIA => 'algeria',
585: self::ECUADOR => 'ecuador',
586: self::ESTONIA => 'estonia',
587: self::EGYPT => 'egypt',
588: self::WESTERN_SAHARA => 'western-sahara',
589: self::ERITREA => 'eritrea',
590: self::SPAIN => 'spain',
591: self::ETHIOPIA => 'ethiopia',
592: self::FINLAND => 'finland',
593: self::FIJI => 'fiji',
594: self::FALKLAND_ISLANDS => 'falkland-islands',
595: self::MICRONESIA => 'micronesia',
596: self::FAROE_ISLANDS => 'faroe-islands',
597: self::FRANCE => 'france',
598: self::GABON => 'gabon',
599: self::UNITED_KINGDOM => 'united-kingdom',
600: self::GRENADA => 'grenada',
601: self::GEORGIA => 'georgia',
602: self::FRENCH_GUIANA => 'french-guiana',
603: self::GUERNSEY => 'guernsey',
604: self::GHANA => 'ghana',
605: self::GIBRALTAR => 'gibraltar',
606: self::GREENLAND => 'greenland',
607: self::GAMBIA => 'gambia',
608: self::GUINEA => 'guinea',
609: self::GUADELOUPE => 'guadeloupe',
610: self::EQUATORIAL_GUINEA => 'equatorial-guinea',
611: self::GREECE => 'greece',
612: self::SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH => 'south-georgia-and-the-south-sandwich',
613: self::GUATEMALA => 'guatemala',
614: self::GUAM => 'guam',
615: self::GUINEA_BISSAU => 'guinea-bissau',
616: self::GUYANA => 'guyana',
617: self::HONG_KONG => 'hong-kong',
618: self::HEARD_ISLAND_AND_MCDONALD_ISLANDS => 'heard-island-and-mcdonald-islands',
619: self::HONDURAS => 'honduras',
620: self::CROATIA => 'croatia',
621: self::HAITI => 'haiti',
622: self::HUNGARY => 'hungary',
623: self::INDONESIA => 'indonesia',
624: self::IRELAND => 'ireland',
625: self::ISRAEL => 'israel',
626: self::ISLE_OF_MAN => 'isle-of-man',
627: self::INDIA => 'india',
628: self::BRITISH_INDIAN_OCEAN_TERRITORY => 'british-indian-ocean-territory',
629: self::IRAQ => 'iraq',
630: self::ISLAMIC_REPUBLIC_OF_IRAN => 'islamic-republic-of-iran',
631: self::ICELAND => 'iceland',
632: self::ITALY => 'italy',
633: self::JERSEY => 'jersey',
634: self::JAMAICA => 'jamaica',
635: self::JORDAN => 'jordan',
636: self::JAPAN => 'japan',
637: self::KENYA => 'kenya',
638: self::KYRGYZSTAN => 'kyrgyzstan',
639: self::CAMBODIA => 'cambodia',
640: self::KIRIBATI => 'kiribati',
641: self::COMOROS => 'comoros',
642: self::SAINT_KITTS_AND_NEVIS => 'saint-kitts-and-nevis',
643: self::NORTH_KOREA => 'north-korea',
644: self::SOUTH_KOREA => 'south-korea',
645: self::KUWAIT => 'kuwait',
646: self::CAYMAN_ISLANDS => 'cayman-islands',
647: self::KAZAKHSTAN => 'kazakhstan',
648: self::LAOS => 'laos',
649: self::LEBANON => 'lebanon',
650: self::SAINT_LUCIA => 'saint-lucia',
651: self::LIECHTENSTEIN => 'liechtenstein',
652: self::SRI_LANKA => 'sri-lanka',
653: self::LIBERIA => 'liberia',
654: self::LESOTHO => 'lesotho',
655: self::LITHUANIA => 'lithuania',
656: self::LUXEMBOURG => 'luxembourg',
657: self::LATVIA => 'latvia',
658: self::LIBYA => 'libya',
659: self::MOROCCO => 'morocco',
660: self::MONACO => 'monaco',
661: self::MOLDOVA => 'moldova',
662: self::MONTENEGRO => 'montenegro',
663: self::SAINT_MARTIN_FRENCH => 'saint-martin-french',
664: self::MADAGASCAR => 'madagascar',
665: self::MARSHALL_ISLANDS => 'marshall-islands',
666: self::MACEDONIA => 'macedonia',
667: self::MALI => 'mali',
668: self::MYANMAR => 'myanmar',
669: self::MONGOLIA => 'mongolia',
670: self::MACAO => 'macao',
671: self::NORTHERN_MARIANA_ISLANDS => 'northern-mariana-islands',
672: self::MARTINIQUE => 'martinique',
673: self::MAURITANIA => 'mauritania',
674: self::MONTSERRAT => 'montserrat',
675: self::MALTA => 'malta',
676: self::MAURITIUS => 'mauritius',
677: self::MALDIVES => 'maldives',
678: self::MALAWI => 'malawi',
679: self::MEXICO => 'mexico',
680: self::MALAYSIA => 'malaysia',
681: self::MOZAMBIQUE => 'mozambique',
682: self::NAMIBIA => 'namibia',
683: self::NEW_CALEDONIA => 'new-caledonia',
684: self::NIGER => 'niger',
685: self::NORFOLK_ISLAND => 'norfolk-island',
686: self::NIGERIA => 'nigeria',
687: self::NICARAGUA => 'nicaragua',
688: self::NETHERLANDS => 'netherlands',
689: self::NORWAY => 'norway',
690: self::NEPAL => 'nepal',
691: self::NAURU => 'nauru',
692: self::NIUE => 'niue',
693: self::NEW_ZEALAND => 'new-zealand',
694: self::OMAN => 'oman',
695: self::PANAMA => 'panama',
696: self::PERU => 'peru',
697: self::FRENCH_POLYNESIA => 'french-polynesia',
698: self::PAPUA_NEW_GUINEA => 'papua-new-guinea',
699: self::PHILIPPINES => 'philippines',
700: self::PAKISTAN => 'pakistan',
701: self::POLAND => 'poland',
702: self::SAINT_PIERRE_AND_MIQUELON => 'saint-pierre-and-miquelon',
703: self::PITCAIRN => 'pitcairn',
704: self::PUERTO_RICO => 'puerto-rico',
705: self::PALESTINE => 'palestine',
706: self::PORTUGAL => 'portugal',
707: self::PALAU => 'palau',
708: self::PARAGUAY => 'paraguay',
709: self::QATAR => 'qatar',
710: self::REUNION => 'reunion',
711: self::ROMANIA => 'romania',
712: self::SERBIA => 'serbia',
713: self::RUSSIA => 'russia',
714: self::RWANDA => 'rwanda',
715: self::SAUDI_ARABIA => 'saudi-arabia',
716: self::SOLOMON_ISLANDS => 'solomon-islands',
717: self::SEYCHELLES => 'seychelles',
718: self::SUDAN => 'sudan',
719: self::SWEDEN => 'sweden',
720: self::SINGAPORE => 'singapore',
721: self::SAINT_HELENA => 'saint-helena',
722: self::SLOVENIA => 'slovenia',
723: self::SVALBARD_AND_JAN_MAYEN => 'svalbard-and-jan-mayen',
724: self::SLOVAKIA => 'slovakia',
725: self::SIERRA_LEONE => 'sierra-leone',
726: self::SAN_MARINO => 'san-marino',
727: self::SENEGAL => 'senegal',
728: self::SOMALIA => 'somalia',
729: self::SURINAME => 'suriname',
730: self::SOUTH_SUDAN => 'south-sudan',
731: self::SAO_TOME_AND_PRINCIPE => 'sao-tome-and-principe',
732: self::EL_SALVADOR => 'el-salvador',
733: self::SAINT_MARTIN_DUTCH => 'saint-martin-dutch',
734: self::SYRIA => 'syria',
735: self::SWAZILAND => 'swaziland',
736: self::TURKS_AND_CAICOS_ISLANDS => 'turks-and-caicos-islands',
737: self::CHAD => 'chad',
738: self::FRENCH_SOUTHERN_TERRITORIES => 'french-southern-territories',
739: self::TOGO => 'togo',
740: self::THAILAND => 'thailand',
741: self::TAJIKISTAN => 'tajikistan',
742: self::TOKELAU => 'tokelau',
743: self::TIMOR_LESTE => 'timor-leste',
744: self::TURKMENISTAN => 'turkmenistan',
745: self::TUNISIA => 'tunisia',
746: self::TONGA => 'tonga',
747: self::TURKEY => 'turkey',
748: self::TRINIDAD_AND_TOBAGO => 'trinidad-and-tobago',
749: self::TUVALU => 'tuvalu',
750: self::TAIWAN => 'taiwan',
751: self::TANZANIA => 'tanzania',
752: self::UKRAINE => 'ukraine',
753: self::UGANDA => 'uganda',
754: self::UNITED_STATES_MINOR_OUTLYING_ISLANDS => 'united-states-minor-outlying-islands',
755: self::UNITED_STATES => 'united-states',
756: self::URUGUAY => 'uruguay',
757: self::UZBEKISTAN => 'uzbekistan',
758: self::VATICAN => 'vatican',
759: self::SAINT_VINCENT_AND_THE_GRENADINES => 'saint-vincent-and-the-grenadines',
760: self::VENEZUELA => 'venezuela',
761: self::VIRGIN_ISLANDS_BRITISH => 'virgin-islands-british',
762: self::VIRGIN_ISLANDS_US => 'virgin-islands-us',
763: self::VIETNAM => 'vietnam',
764: self::VANUATU => 'vanuatu',
765: self::WALLIS_AND_FUTUNA => 'wallis-and-futuna',
766: self::SAMOA => 'samoa',
767: self::KOSOVO => 'kosovo',
768: self::YEMEN => 'yemen',
769: self::MAYOTTE => 'mayotte',
770: self::SOUTH_AFRICA => 'south-africa',
771: self::ZAMBIA => 'zambia',
772: self::ZIMBABWE => 'zimbabwe',
773: ];
774:
775: public function getName(): string
776: {
777: return self::$names[$this->getValue()];
778: }
779:
780: public function getIdent(): string
781: {
782: return self::$idents[$this->getValue()];
783: }
784:
785: public function getSymbol(): string
786: {
787: $code = $this->getValue();
788:
789: return "\xF0\x9F\x87" . chr(ord($code[0]) + 0x65) . "\xF0\x9F\x87" . chr(ord($code[1]) + 0x65);
790: }
791:
792: public static function getByIdent(string $ident): self
793: {
794: return self::get(array_search($ident, self::$idents));
795: }
796:
797: public static function validateValue(string &$value): bool
798: {
799: $value = strtoupper($value);
800:
801: return parent::validateValue($value);
802: }
803:
804: }
| 0 % | Database\Charset\MysqlCharset.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database\Charset;
11:
12: use Dogma\Language\Encoding;
13:
14: class MysqlCharset extends \Dogma\Enum\StringEnum
15: {
16:
17: public const ARMSCII_8 = 'armscii8';
18: public const ASCII = 'ascii';
19: public const BIG_5 = 'big5';
20: public const BINARY = 'binary';
21: public const CP1250 = 'cp1250';
22: public const CP1251 = 'cp1251';
23: public const CP1256 = 'cp1256';
24: public const CP1257 = 'cp1257';
25: public const CP850 = 'cp850';
26: public const CP852 = 'cp852';
27: public const CP866 = 'cp866';
28: public const CP932 = 'cp932';
29: public const DEC_8 = 'dec8';
30: public const EUC_JP_MS = 'eucjpms';
31: public const EUC_KR = 'euckr';
32: public const GB18030 = 'gb18030';
33: public const GB2312 = 'gb2312';
34: public const GBK = 'gbk';
35: public const GEOSTD_8 = 'geostd8';
36: public const GREEK = 'greek';
37: public const HEBREW = 'hebrew';
38: public const HP_8 = 'hp8';
39: public const KEYBCS_2 = 'keybcs2';
40: public const KOI8_R = 'koi8r';
41: public const KOI8_U = 'koi8u';
42: public const LATIN_1 = 'latin1';
43: public const LATIN_2 = 'latin2';
44: public const LATIN_5 = 'latin5';
45: public const LATIN_7 = 'latin7';
46: public const MAC_CE = 'macce';
47: public const MAC_ROMAN = 'macroman';
48: public const SJIS = 'sjis';
49: public const SWE_7 = 'swe7';
50: public const TIS_620 = 'tis620';
51: public const UCS_2 = 'ucs2';
52: public const UJIS = 'ujis';
53: public const UTF_16 = 'utf16';
54: public const UTF_16LE = 'utf16le';
55: public const UTF_32 = 'utf32';
56: public const UTF_8_OLD = 'utf8';
57: public const UTF_8 = 'utf8mb4';
58:
59: /** @var string[] */
60: private static $mapping = [
61: Encoding::ARMSCII_8 => self::ARMSCII_8,
62: Encoding::ASCII => self::ASCII,
63: Encoding::BIG_5 => self::BIG_5,
64: Encoding::BINARY => self::BINARY,
65: Encoding::WINDOWS_1250 => self::CP1250,
66: Encoding::WINDOWS_1251 => self::CP1251,
67: Encoding::WINDOWS_1256 => self::CP1256,
68: Encoding::WINDOWS_1257 => self::CP1257,
69: Encoding::CP850 => self::CP850,
70: Encoding::CP852 => self::CP852,
71: Encoding::CP866 => self::CP866,
72: Encoding::CP932 => self::CP932,
73: // DEC_8
74: Encoding::EUC_JP_WIN => self::EUC_JP_MS,
75: Encoding::EUC_KR => self::EUC_KR,
76: Encoding::GB18030 => self::GB18030,
77: // GB2312
78: // GBK
79: // GEOSTD_8
80: Encoding::ISO_8859_7 => self::GREEK,
81: Encoding::ISO_8859_8 => self::HEBREW,
82: // HP_8
83: // KEYBCS_2
84: Encoding::KOI8_R => self::KOI8_R,
85: Encoding::KOI8_U => self::KOI8_U,
86: Encoding::ISO_8859_1 => self::LATIN_1,
87: Encoding::ISO_8859_2 => self::LATIN_2,
88: Encoding::ISO_8859_9 => self::LATIN_5,
89: Encoding::ISO_8859_13 => self::LATIN_7,
90: // MAC_CE
91: // MAC_ROMAN
92: Encoding::SJIS => self::SJIS,
93: // SWE_7
94: // TIS_620
95: Encoding::UCS_2 => self::UCS_2,
96: // UJIS
97: Encoding::UTF_16 => self::UTF_16,
98: Encoding::UTF_16BE => self::UTF_16,
99: Encoding::UTF_16LE => self::UTF_16LE,
100: Encoding::UTF_32 => self::UTF_32,
101: // UTF_8_OLD
102: Encoding::UTF_8 => self::UTF_8,
103: ];
104:
105: public static function fromEncoding(Encoding $encoding): self
106: {
107: if (!isset(self::$mapping[$encoding->getValue()])) {
108: throw new \Dogma\InvalidValueException($encoding->getValue(), __CLASS__);
109: }
110: return self::get(self::$mapping[$encoding->getValue()]);
111: }
112:
113: }
| 0 % | Database\Charset\MysqlCollation.php |
<?php
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database\Charset;
11:
12: use Dogma\Check;
13: use Dogma\Language\Encoding;
14: use Dogma\Language\Language;
15: use Dogma\Language\Locale\Locale;
16: use Dogma\Language\Locale\LocaleVariant;
17: use Dogma\Type;
18:
19: class MysqlCollation extends \Dogma\Enum\PartialStringEnum
20: {
21:
22: public const BINARY = 'binary';
23:
24: public const ASCII_BIN = 'ascii_bin';
25: public const ASCII_GENERAL = 'ascii_general_ci';
26:
27: public const UTF_8_BIN = 'utf8mb4_bin';
28: public const UTF_8_GENERAL = 'utf8mb4_general_ci';
29: public const UTF_8_UNICODE_520 = 'utf8mb4_unicode_520_ci';
30: ///public const UTF_8_UNICODE_800 = 'utf8mb4_unicode_520_ci';
31:
32: public const UTF_8_CROATIAN = 'utf8mb4_croatian_ci';
33: public const UTF_8_CZECH = 'utf8mb4_czech_ci';
34: public const UTF_8_DANISH = 'utf8mb4_danish_ci';
35: public const UTF_8_ESPERANTO = 'utf8mb4_esperanto_ci';
36: public const UTF_8_ESTONIAN = 'utf8mb4_estonian_ci';
37: public const UTF_8_GERMAN = 'utf8mb4_german2_ci';
38: public const UTF_8_HUNGARIAN = 'utf8mb4_hungarian_ci';
39: public const UTF_8_ICELANDIC = 'utf8mb4_icelandic_ci';
40: public const UTF_8_LATVIAN = 'utf8mb4_latvian_ci';
41: public const UTF_8_LITHUANIAN = 'utf8mb4_lithuanian_ci';
42: public const UTF_8_PERSIAN = 'utf8mb4_persian_ci';
43: public const UTF_8_POLISH = 'utf8mb4_polish_ci';
44: public const UTF_8_ROMAN = 'utf8mb4_roman_ci';
45: public const UTF_8_ROMANIAN = 'utf8mb4_romanian_ci';
46: public const UTF_8_SINHALA = 'utf8mb4_sinhala_ci';
47: public const UTF_8_SLOVAK = 'utf8mb4_slovak_ci';
48: public const UTF_8_SLOVENIAN = 'utf8mb4_slovenian_ci';
49: public const UTF_8_SPANISH = 'utf8mb4_spanish2_ci';
50: public const UTF_8_SWEDISH = 'utf8mb4_swedish_ci';
51: public const UTF_8_TURKISH = 'utf8mb4_turkish_ci';
52: public const UTF_8_VIETNAMESE = 'utf8mb4_vietnamese_ci';
53:
54: /**
55: * @param \Dogma\Language\Encoding|\Dogma\Database\Charset\MysqlCharset $charset
56: * @param \Dogma\Language\Language|\Dogma\Language\Locale\Locale|\Dogma\Database\Charset\MysqlCollationType|null $collation
57: * @return self
58: */
59: public function create($charset, $collation = null): self
60: {
61: Check::types($charset, [Encoding::class, MysqlCharset::class]);
62: Check::types($collation, [Language::class, Locale::class, MysqlCollationType::class, Type::NULL]);
63:
64: if ($charset instanceof Encoding) {
65: $charsetCode = MysqlCharset::fromEncoding($charset)->getValue();
66: } else {
67: $charsetCode = $charset->getValue();
68: }
69: if ($charsetCode === Encoding::BINARY) {
70: return self::get(self::BINARY);
71: }
72:
73: if ($collation instanceof MysqlCollationType) {
74: $type = $collation->getValue();
75: $language = null;
76: } else {
77: $type = $collation ? MysqlCollationType::LOCALE_CI : MysqlCollationType::UNICODE_CI;
78:
79: if ($collation instanceof Locale) {
80: $language = $collation->getLanguage();
81: } else {
82: $language = $collation;
83: }
84: }
85:
86: if ($type === MysqlCollationType::LOCALE_CI) {
87: $languageName = $language->getIdent();
88: if (($languageName === 'german' || $languageName === 'spanish')
89: && (!$collation instanceof Locale || !$collation->hasVariant(LocaleVariant::TRADITIONAL))
90: ) {
91: // use last version
92: $languageName .= '2';
93: }
94: return self::get($charsetCode . '_' . $languageName . '_' . $type);
95: } else {
96: return self::get($charsetCode . '_' . $type);
97: }
98: }
99:
100: public static function validateValue(string &$value): bool
101: {
102: $value = strtolower($value);
103:
104: return parent::validateValue($value);
105: }
106:
107: public static function getValueRegexp(): string
108: {
109: return 'binary|[a-z]{2}[a-z0-9]+(?:_bin|[a-z]+(?:2)?(?:_520|_mysql500)?_ci)';
110: }
111:
112: }
| 0 % | Database\Charset\MysqlCollationType.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database\Charset;
11:
12: class MysqlCollationType extends \Dogma\Enum\StringEnum
13: {
14:
15: public const LOCALE_CI = 'ci';
16: public const UNICODE_CI = 'unicode_520_ci';
17: public const GENERAL_CI = 'general_ci';
18: public const BINARY = 'bin';
19:
20: public const OLD_GENERAL_CI = 'general_mysql500_ci';
21: public const OLD_UNICODE_CI = 'unicode_ci';
22:
23: }
| 0 % | Database\exceptions\AbortedException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Operation was aborted by admin. */
13: class AbortedException extends \Dogma\Database\ConcurrencyException
14: {
15:
16: }
| 0 % | Database\exceptions\AccessDeniedException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Insufficient user privileges. */
13: class AccessDeniedException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\BinlogException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Binary logging error. */
13: class BinlogException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\CollationException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Text collation error or mismatch. */
13: class CollationException extends \Dogma\Database\SyntaxErrorException
14: {
15:
16: }
| 0 % | Database\exceptions\ConcurrencyException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Concurrency issues. */
13: class ConcurrencyException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\ConfigException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Wrong or unreadable configuration file. */
13: class ConfigException extends \Dogma\Database\FailureException
14: {
15:
16: }
| 0 % | Database\exceptions\ConnectionErrorException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Connection failure. */
13: class ConnectionErrorException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\CorruptedException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Corrupted or obsolete database structures. */
13: class CorruptedException extends \Dogma\Database\FailureException
14: {
15:
16: }
| 0 % | Database\exceptions\DatabaseException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Database error. */
13: class DatabaseException extends \Exception
14: {
15:
16: }
| 0 % | Database\exceptions\DeadlockException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Deadlock. Cannot be prevented. Run transaction again. */
13: class DeadlockException extends \Dogma\Database\LockException
14: {
15:
16: }
| 0 % | Database\exceptions\DebugException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Debugging and unhandled user errors. */
13: class DebugException extends \Dogma\Database\QueryException
14: {
15:
16: }
| 0 % | Database\exceptions\DuplicateEntryException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Duplicate entry (integrity constraint error). */
13: class DuplicateEntryException extends \Dogma\Database\IntegrityConstraintException
14: {
15:
16: }
| 0 % | Database\exceptions\EventException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Events or event scheduler error. */
13: class EventException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\ExtensionException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** User extensions or UDF error. */
13: class ExtensionException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\FailureException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Exception caused by admin, configuration, runtime or system failure. */
13: class FailureException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\FilesException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Tablespace and file groups error. */
13: class FilesException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\InsufficientResourcesException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** System resources (RAM, disk, threads...) temporarily depleted. */
13: class InsufficientResourcesException extends \Dogma\Database\ResourcesException
14: {
15:
16: }
| 0 % | Database\exceptions\IntegrityConstraintException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Integrity constraint error. */
13: class IntegrityConstraintException extends \Dogma\Database\QueryException
14: {
15:
16: }
| 0 % | Database\exceptions\InvalidValueException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Invalid value given by user or returned by query. */
13: class InvalidValueException extends \Dogma\Database\SyntaxErrorException
14: {
15:
16: }
| 0 % | Database\exceptions\LimitsExceededException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Configured or native database limits exceeded. */
13: class LimitsExceededException extends \Dogma\Database\ResourcesException
14: {
15:
16: }
| 0 % | Database\exceptions\LockException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Cannot perform operation due to locks. */
13: class LockException extends \Dogma\Database\ConcurrencyException
14: {
15:
16: }
| 0 % | Database\exceptions\LogicErrorException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Statement logic error. You are doing something wrong. */
13: class LogicErrorException extends \Dogma\Database\QueryException
14: {
15:
16: }
| 0 % | Database\exceptions\NameConflictException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Entity (table, column, index...) already exists. */
13: class NameConflictException extends \Dogma\Database\LogicErrorException
14: {
15:
16: }
| 0 % | Database\exceptions\NotFoundException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Entity (table, column, index...) was not found. */
13: class NotFoundException extends \Dogma\Database\QueryException
14: {
15:
16: }
| 0 % | Database\exceptions\NotSupportedException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Operation is not supported in this context, configuration or version. */
13: class NotSupportedException extends \Dogma\Database\LogicErrorException
14: {
15:
16: }
| 0 % | Database\exceptions\PartitioningException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Table partitioning error. */
13: class PartitioningException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\QueryException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Exception caused by user mistake. */
13: class QueryException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\RemoteStorageException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Remote server or FEDERATED engine error. */
13: class RemoteStorageException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\ReplicationException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Master/slave replication error. */
13: class ReplicationException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\ResourcesException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Resource or configuration limit reached. */
13: class ResourcesException extends \Dogma\Database\FailureException
14: {
15:
16: }
| 0 % | Database\exceptions\RuntimeException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Miscellaneous runtime exceptions (probably not caused by user). */
13: class RuntimeException extends \Dogma\Database\FailureException
14: {
15:
16: }
| 0 % | Database\exceptions\ServiceUnavailableException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Server is temporarily unavailable. Connection refused or aborted. */
13: class ServiceUnavailableException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 0 % | Database\exceptions\StorageException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Database storage errors caused by the underlying filesystem. */
13: class StorageException extends \Dogma\Database\RuntimeException
14: {
15:
16: }
| 0 % | Database\exceptions\SyntaxErrorException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Statement syntax error caused by user. */
13: class SyntaxErrorException extends \Dogma\Database\QueryException
14: {
15:
16: }
| 0 % | Database\exceptions\XaException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database;
11:
12: /** Distributed 'XA' transaction error. */
13: class XaException extends \Dogma\Database\DatabaseException
14: {
15:
16: }
| 57 % | Database\SqlGenerator\CreateTableGenerator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Database\SqlGenerator;
11:
12: use Dogma\Mapping\MappingContainer;
13: use Dogma\Type;
14:
15: class CreateTableGenerator
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var \Dogma\Mapping\MappingContainer */
20: private $mappingContainer;
21:
22: public function __construct(MappingContainer $mappingContainer)
23: {
24: $this->mappingContainer = $mappingContainer;
25: }
26:
27: public function generate(Type $type): string
28: {
29: $mapping = $this->mappingContainer->getMapping($type);
30:
31: dump($mapping);
32:
33: return '';
34: }
35:
36: }
| 0 % | Dom\Document.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Dom;
11:
12: class Document extends \DOMDocument
13: {
14:
15: /** @var \Dogma\Dom\QueryEngine */
16: private $engine;
17:
18: /**
19: * XML or HTML content or file path prefixed with '@'
20: * @param string|null $document
21: * @param string $version
22: * @param string $encoding
23: */
24: public function __construct(?string $document = null, string $version = '1.0', string $encoding = 'utf-8')
25: {
26: parent::__construct($version, $encoding);
27:
28: if (!$document) {
29: return;
30: }
31:
32: if (substr($document, 0, 1) === '@') {
33: ///
34:
35: } else {
36: if (preg_match('/<!DOCTYPE\\s+HTML/i', $document)) {
37: $this->loadHtml($document);
38:
39: } elseif (preg_match('/\\s*<\\?xml/i', $document)) {
40: $this->loadXml($document);
41:
42: } else {
43: $this->loadHtml($document);
44: }
45: }
46:
47: $this->engine = new QueryEngine($this);
48: }
49:
50: public function setQueryEngine(QueryEngine $engine): void
51: {
52: $this->engine = $engine;
53: }
54:
55: public function getQueryEngine(): QueryEngine
56: {
57: return $this->engine;
58: }
59:
60: /**
61: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
62: * @param string $source
63: * @param int|null $options
64: */
65: public function loadXml($source, $options = null): void
66: {
67: libxml_use_internal_errors(true);
68: libxml_clear_errors();
69: if (!parent::loadXML($source, $options)) {
70: $error = libxml_get_last_error();
71: throw new \Dogma\Dom\DomException('Cannot load HTML document: ' . trim($error->message) . ' on line #' . $error->line, $error->code);
72: }
73: }
74:
75: /**
76: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
77: * @param string $source
78: * @param int|null $options
79: */
80: public function loadHtml($source, $options = null): void
81: {
82: $previousState = libxml_use_internal_errors(true);
83: libxml_clear_errors();
84: if (!parent::loadHTML($source, $options)) {
85: $error = libxml_get_last_error();
86: libxml_use_internal_errors($previousState);
87: throw new \Dogma\Dom\DomException('Cannot load HTML document: ' . trim($error->message) . ' on line #' . $error->line, $error->code);
88: }
89: libxml_use_internal_errors($previousState);
90: }
91:
92: /**
93: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
94: * @param string $fileName
95: * @param int|null $options
96: */
97: public function loadHtmlFile($fileName, $options = null): void
98: {
99: libxml_use_internal_errors(true);
100: libxml_clear_errors();
101: if (!parent::loadHTMLFile($fileName)) {
102: $error = libxml_get_last_error();
103: throw new \Dogma\Dom\DomException('Cannot load HTML document: ' . trim($error->message) . ' on line #' . $error->line, $error->code);
104: }
105: }
106:
107: /**
108: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
109: * @param string $id
110: * @return \Dogma\Dom\Element|\DOMNode|null
111: */
112: public function getElementById($id)
113: {
114: $element = parent::getElementById($id);
115:
116: return $element ? $this->wrap($element) : null;
117: }
118:
119: /**
120: * @param string $xpath
121: * @return \Dogma\Dom\NodeList
122: */
123: public function find(string $xpath): NodeList
124: {
125: return $this->engine->find($xpath);
126: }
127:
128: /**
129: * @param string $xpath
130: * @return \Dogma\Dom\Element|\DOMNode
131: */
132: public function findOne(string $xpath)
133: {
134: return $this->engine->findOne($xpath);
135: }
136:
137: /**
138: * @param string $xpath
139: * @return string|int|float
140: */
141: public function evaluate(string $xpath)
142: {
143: return $this->engine->evaluate($xpath);
144: }
145:
146: /**
147: * @param string|string[] $target
148: * @return string|string[]
149: */
150: public function extract($target)
151: {
152: return $this->engine->extract($target);
153: }
154:
155: public function dump(): void
156: {
157: Dumper::dump($this);
158: }
159:
160: /**
161: * @param \DOMNode $node
162: * @return \Dogma\Dom\Element|\DOMNode
163: */
164: private function wrap(\DOMNode $node)
165: {
166: if ($node instanceof \DOMElement) {
167: return new Element($node, $this->engine);
168: } else {
169: return $node;
170: }
171: }
172:
173: }
| 0 % | Dom\Dumper.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Dom;
11:
12: class Dumper
13: {
14: use \Dogma\StaticClassMixin;
15:
16: /**
17: * @param \Dogma\Dom\Element|\Dogma\Dom\NodeList|\DOMNode $node
18: * @param int $maxDepth
19: * @param int $depth
20: * @param bool $onlyChild
21: */
22: public static function dump($node, int $maxDepth = 15, int $depth = 0, bool $onlyChild = false): void
23: {
24: if ($depth > $maxDepth) {
25: echo '…';
26: }
27: if ($depth === 0) {
28: echo '<pre><code>';
29: }
30:
31: if ($node instanceof Element || $node instanceof \DOMElement) {
32: self::dumpElement($node, $maxDepth, $depth, $onlyChild);
33:
34: } elseif ($node instanceof \DOMDocument) {
35: if ($depth === 0) {
36: echo "<b>Document:</b>\n";
37: }
38: self::dump($node->documentElement, $maxDepth);
39:
40: } elseif ($node instanceof \DOMCdataSection) {
41: if ($depth === 0) {
42: echo "<b>CdataSection:</b>\n";
43: }
44: echo '<i style="color: purple">', htmlspecialchars(trim($node->data)), '</i>';
45:
46: } elseif ($node instanceof \DOMComment) {
47: if ($depth === 0) {
48: echo "<b>Comment:</b>\n";
49: }
50: echo '<i style="color: gray"><!-- ', trim($node->data), " --></i>\n";
51:
52: } elseif ($node instanceof \DOMText) {
53: if ($depth === 0) {
54: echo "<b>Text:</b>\n";
55: }
56: $string = preg_replace('/[ \\t]+/', ' ', trim($node->wholeText));
57: echo '<i>', $string, '</i>';
58:
59: } elseif ($node instanceof NodeList) {
60: echo '<b>NodeList (', count($node), ")</b>\n";
61: foreach ($node as $item) {
62: echo '<hr style="border: 1px silver solid; border-width: 1px 0px 0px 0px">';
63: echo ' ';
64: self::dump($item, $maxDepth, $depth + 1, true);
65: }
66:
67: } else {
68: echo '[something]';
69: throw new \Dogma\NotImplementedException('Dom dumper found some strange thing.');
70: }
71:
72: if ($depth === 0) {
73: echo '<code></pre>';
74: }
75: }
76:
77: /**
78: * @param \Dogma\Dom\Element|\DOMNode $node
79: * @param int $maxDepth
80: * @param int $depth
81: * @param bool $onlyChild
82: */
83: private static function dumpElement($node, int $maxDepth = 15, int $depth = 0, bool $onlyChild = false): void
84: {
85: if ($depth === 0) {
86: echo "<b>Element:</b>\n";
87: }
88: if (!$onlyChild) {
89: echo str_repeat(' ', $depth);
90: }
91: echo '<b><</b><b style="color:red">', $node->nodeName, '</b>';
92:
93: foreach ($node->attributes as $attribute) {
94: echo ' <span style="color: green">', $attribute->name, '</span>=<span style="color:blue">"', $attribute->value, '"</span>';
95: }
96:
97: echo '<b>></b>';
98:
99: if ($node->childNodes->length > 1) {
100: echo "\n";
101: }
102: foreach ($node->childNodes as $child) {
103: self::dump($child, $maxDepth, $depth + 1, $node->childNodes->length === 1);
104: }
105: if ($node->childNodes->length > 1) {
106: echo str_repeat(' ', $depth);
107: }
108:
109: echo '<b><</b>/<b style="color: red">', $node->nodeName, '</b><b>></b>';
110: if (!$onlyChild) {
111: echo "\n";
112: }
113: }
114:
115: }
| 0 % | Dom\Element.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Dom;
11:
12: /**
13: * @property-read string $nodeName
14: */
15: class Element
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var \Dogma\Dom\QueryEngine */
20: private $engine;
21:
22: /** @var \DOMElement */
23: private $element;
24:
25: public function __construct(\DOMElement $element, QueryEngine $engine)
26: {
27: $this->element = $element;
28: $this->engine = $engine;
29: }
30:
31: public function find(string $xpath): NodeList
32: {
33: return $this->engine->find($xpath, $this->element);
34: }
35:
36: /**
37: * @param string $xpath
38: * @return \Dogma\Dom\Element|\DOMNode|null
39: */
40: public function findOne(string $xpath)
41: {
42: return $this->engine->findOne($xpath, $this->element);
43: }
44:
45: /**
46: * @param string $xpath
47: * @return string|int|float
48: */
49: public function evaluate(string $xpath)
50: {
51: return $this->engine->evaluate($xpath, $this->element);
52: }
53:
54: /**
55: * @param string|string[] $target
56: * @return string|string[]
57: */
58: public function extract($target)
59: {
60: return $this->engine->extract($target, $this->element);
61: }
62:
63: public function getElement(): \DOMElement
64: {
65: return $this->element;
66: }
67:
68: public function remove(): bool
69: {
70: $this->element->parentNode->removeChild($this->element);
71:
72: return true;
73: }
74:
75: /**
76: * @param string $name
77: * @return mixed
78: */
79: public function &__get(string $name)
80: {
81: $val = $this->element->$name;
82:
83: return $val;
84: }
85:
86: /**
87: * @param string $name
88: * @param mixed $arg
89: * @return mixed
90: */
91: public function __call(string $name, $arg)
92: {
93: $args = func_get_args();
94:
95: return call_user_func([$this->element, $name], array_shift($args));
96: }
97:
98: public function dump(): void
99: {
100: Dumper::dump($this);
101: }
102:
103: }
| 0 % | Dom\exceptions\DomException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Dom;
11:
12: class DomException extends \Dogma\Exception
13: {
14:
15: public function __construct(string $message, int $code = 0, ?\Throwable $previous = null)
16: {
17: parent::__construct($message, $previous);
18:
19: $this->code = $code;
20: }
21:
22: }
| 0 % | Dom\exceptions\QueryEngineException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Dom;
11:
12: class QueryEngineException extends \Dogma\Dom\DomException
13: {
14:
15: //
16:
17: }
| 0 % | Dom\Html\HtmlTableIterator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Dom\Html;
11:
12: use Dogma\Dom\Element;
13:
14: class HtmlTableIterator implements \Iterator
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var \Dogma\Dom\Element */
19: private $table;
20:
21: /** @var string[] */
22: private $head;
23:
24: /** @var \Dogma\Dom\NodeList */
25: private $rows;
26:
27: /** @var int */
28: private $position;
29:
30: public function __construct(Element $table)
31: {
32: if ($table->nodeName !== 'table') {
33: throw new \InvalidArgumentException(sprintf('Element must be a table. %s given!', $table->nodeName));
34: }
35:
36: $this->table = $table;
37: }
38:
39: public function rewind(): void
40: {
41: if (!$this->head) {
42: $this->processTable();
43: }
44: $this->position = 0;
45: }
46:
47: public function next(): void
48: {
49: $this->position++;
50: }
51:
52: /**
53: * @return bool
54: */
55: public function valid(): bool
56: {
57: return $this->position < count($this->rows);
58: }
59:
60: /**
61: * @return int
62: */
63: public function key(): int
64: {
65: return $this->position;
66: }
67:
68: /**
69: * @return string[]
70: */
71: public function current(): string
72: {
73: return $this->formatRow($this->rows->item($this->position));
74: }
75:
76: private function processTable(): void
77: {
78: foreach ($this->table->find(':headrow/:cell') as $cell) {
79: $this->head[] = $cell->textContent;
80: }
81: $this->rows = $this->table->find(':bodyrow');
82: }
83:
84: /**
85: * @param \Dogma\Dom\Element $row
86: * @return string[]
87: */
88: private function formatRow(Element $row): array
89: {
90: $res = [];
91: foreach ($row->find(':cell') as $i => $cell) {
92: $res[$this->head[$i]] = $cell->textContent;
93: }
94: return $res;
95: }
96:
97: }
| 0 % | Dom\NodeList.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Dom;
11:
12: class NodeList implements \Countable, \Iterator
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var \DOMNodeList */
17: private $nodeList;
18:
19: /** @var \Dogma\Dom\QueryEngine */
20: private $engine;
21:
22: /** @var int */
23: private $offset = 0;
24:
25: public function __construct(\DOMNodeList $nodeList, QueryEngine $engine)
26: {
27: $this->nodeList = $nodeList;
28: $this->engine = $engine;
29: }
30:
31: /**
32: * @param int $offset
33: * @return \Dogma\Dom\Element|\DOMNode
34: */
35: public function item(int $offset)
36: {
37: return $this->wrap($this->nodeList->item($offset));
38: }
39:
40: public function count(): int
41: {
42: // PHP bug - cannot count items using $length
43: $n = 0;
44: while ($this->nodeList->item($n)) {
45: $n++;
46: }
47: return $n;
48: }
49:
50: /**
51: * @return \Dogma\Dom\Element|\DOMNode
52: */
53: public function current()
54: {
55: return $this->wrap($this->nodeList->item($this->offset));
56: }
57:
58: public function key(): int
59: {
60: return $this->offset;
61: }
62:
63: public function next(): void
64: {
65: $this->offset++;
66: }
67:
68: public function rewind(): void
69: {
70: $this->offset = 0;
71: }
72:
73: public function valid(): bool
74: {
75: // PHP bug - cannot iterate through items
76: return $this->nodeList->item($this->offset) !== null;
77: }
78:
79: /**
80: * @param \DOMNode $node
81: * @return \Dogma\Dom\Element|\DOMNode
82: */
83: private function wrap(\DOMNode $node)
84: {
85: if ($node instanceof \DOMElement) {
86: return new Element($node, $this->engine);
87: } else {
88: return $node;
89: }
90: }
91:
92: public function dump(): void
93: {
94: Dumper::dump($this);
95: }
96:
97: }
| 0 % | Dom\QueryEngine.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Dom;
11:
12: use Dogma\Str;
13: use Dogma\Time\DateTime;
14:
15: /**
16: * Simple query engine based on XPath 1.0
17: */
18: class QueryEngine
19: {
20: use \Dogma\StrictBehaviorMixin;
21:
22: /** @var \DOMXPath */
23: private $xpath;
24:
25: /** @var string[] (string $pattern => string $replacement) */
26: private $translations = [
27: // index: [n]
28: '/\\[([0-9]+)..([0-9]+)\\]/' => '[position() >= $1 and position() <= $2]', // [m..n]
29: '/\\[..([0-9]+)\\]/' => '[position() <= $1]', // [..n]
30: '/\\[([0-9]+)..\\]/' => '[position() >= $1]', // [n..]
31: '/\\[-([0-9]+)\\]/' => '[position() = last() + 1 - $1]', // nth from end: [-n]
32: '/\\[:first\\]/' => '[1]', // [:first]
33: '/\\[:last\\]/' => '[last()]', // [:last]
34: '/\\[:even\\]/' => '[position() mod 2]', // [:even]
35: '/\\[:odd\\]/' => '[not(position() mod 2)]', // [:odd]
36: '/\\[:only\\]/' => '[position() = 1 and position() = last()]', // [:only]
37:
38: // class: [.foo]
39: '/\\[\\.([A-Za-z0-9_-]+)\\]/' => '[contains(concat(" ", normalize-space(@class), " "), " $1 ")]',
40:
41: // id: [#foo]
42: '/\\[#([A-Za-z0-9_-]+)\\]/' => '[@id = "$1"]',
43:
44: // name: ["foo"]
45: '/\\["([^"]+)"\\]/' => '[@name = "$1"]',
46: "/\\['([^']+)'\\]/" => "[@name = '$1']",
47:
48: // content equals: [="foo"]
49: '/\\[="([^"]+)"\\]/' => '[string() = "$1"]',
50: "/\\[='([^']+)'\\]/" => "[string() = '$1']",
51:
52: // content matches: [~"/foo/i"]
53: '/\\[~"([^"]+)"\\]/' => "[php:functionString('Dogma\\Dom\\QueryEngine::match', string(), \"$1\")]",
54: "/\\[~'([^']+)'\\]/" => "[php:functionString('Dogma\\Dom\\QueryEngine::match', string(), '$1')]",
55:
56: // label: [label("foo")]
57: '/\\[label\\("([^"]+)"\\)\\]/' => '[
58: (ancestor::label[normalize-space() = "$1"]) or
59: (@id = ancestor::form/descendant::label[normalize-space() = "$1"]/@for) or
60: ((@type = "submit" or @type = "reset" or @type = "button") and @value = "$1") or
61: (@type = "button" and normalize-space() = "$1")]',
62: "/\\[label\\('([^']+)'\\)\\]/" => '[
63: (ancestor::label[normalize-space() = \'$1\']) or
64: (@id = ancestor::form/descendant::label[normalize-space() = \'$1\']/@for) or
65: ((@type = "submit" or @type = "reset" or @type = "button") and @value = \'$1\') or
66: (@type = "button" and normalize-space() = \'$1\')]',
67:
68: // axes 'next' and 'previous'
69: '#/previous::([A-Za-z0-9_-]+)#' => '/preceding-sibling::$1[last()]',
70: '#/next::([A-Za-z0-9_-]+)#' => '/following-sibling::$1[1]',
71:
72: // table shortcuts
73: '/:headrow/' => "tr[name(..) = 'thead' or (name(..) = 'table' and not(../thead) and position() = 1)]",
74: '/:bodyrow/' => "tr[name(..) = 'tbody' or (name(..) = 'table' and not(../tbody) and (../thead or position() != 1))]",
75: '/:footrow/' => "tr[name(..) = 'tfoot' or (name(..) = 'table' and not(../tfoot) and position() = last()]",
76: '/:cell/' => "*[name() = 'td' or name() = 'th']",
77:
78: // function shortcuts
79: '/int\\(/' => 'number(.//',
80: '/float\\(/' => 'number(.//',
81: '/bool\\(/' => 'php:functionString("Dogma\\Dom\\QueryEngine::bool", .//',
82: '/date\\(/' => 'php:functionString("Dogma\\Dom\\QueryEngine::date", .//',
83: '/datetime\\(/' => 'php:functionString("Dogma\\Dom\\QueryEngine::datetime", .//',
84: '/match\\(/' => 'php:functionString("Dogma\\Dom\\QueryEngine::match", .//',
85: '/replace\\(/' => 'php:functionString("Dogma\\Dom\\QueryEngine::replace", .//',
86:
87: // jQuery-like shortcuts
88: /*
89: '/:input/' => "*[name() = 'input' or name() = 'textarea' or name() = 'select' or name() = 'button']",
90: '/:file/' => "input[@type = 'file']",
91: '/:button/' => "*[name() = 'button' or (name() = 'input' and @type = 'button')]",
92: '/:submit/' => "input[@type = 'submit']",
93: '/:reset/' => "input[@type = 'reset']",
94: '/:image/' => "input[@type = 'image']",
95: '/:radio/' => "input[@type = 'radio']",
96: '/:checkbox/' => "input[@type = 'checkbox']",
97: '/:text/' => "*[name() = 'textarea'
98: or (name() = 'input' and (@type = 'text' or @type= 'hidden' or not(@type)))]",
99: '/:password/' => "input[@type = 'password']",
100:
101: '/:header/' => "*[name() = 'h1' or name() = 'h2' or name() = 'h3' or name() = 'h4' or name() = 'h5' or name() = 'h6']",
102: '/:link/' => "a[@href]",
103: '/:anchor/' => "*[@id or (name() = 'a' and @name)]",
104: */
105: ];
106:
107: /** @var string[] */
108: private $nativeFunctions = [
109: 'position',
110: 'last',
111: 'count',
112: 'id',
113: 'name',
114: 'local-name',
115: 'namespace-uri',
116:
117: 'string',
118: 'concat',
119: 'starts-with',
120: 'contains',
121: 'substring',
122: 'substring-before',
123: 'substring-after',
124: 'string-length',
125: 'normalize-space',
126: 'translate',
127:
128: 'boolean',
129: 'not',
130: 'true',
131: 'false',
132: 'lang',
133: 'number',
134: 'floor',
135: 'ceiling',
136: 'round',
137: 'sum',
138:
139: 'function',
140: 'functionString',
141:
142: 'match',
143: 'replace',
144: 'date',
145: 'datetime',
146: 'bool',
147: ];
148:
149: /** @var string[] */
150: private $userFunctions = [
151: 'Dogma\\Dom\\QueryEngine::match',
152: 'Dogma\\Dom\\QueryEngine::replace',
153: 'Dogma\\Dom\\QueryEngine::date',
154: 'Dogma\\Dom\\QueryEngine::datetime',
155: 'Dogma\\Dom\\QueryEngine::bool',
156: ];
157:
158: public function __construct(\DOMDocument $dom)
159: {
160: $this->xpath = new \DOMXPath($dom);
161:
162: $this->xpath->registerNamespace('php', 'http://php.net/xpath');
163: $this->xpath->registerPhpFunctions($this->userFunctions);
164: }
165:
166: public function registerFunction(string $name, string $alias = '', bool $expectNode = false): void
167: {
168: if (!$alias) {
169: $alias = $name;
170: }
171: if (in_array($alias, $this->nativeFunctions)) {
172: throw new \Dogma\Dom\QueryEngineException(sprintf('Function \'%s\' is already registered.', $alias));
173: }
174:
175: if ($expectNode) {
176: $this->translations['/' . $alias . '\\(/'] = sprintf('php:function(\'%s\', .//', $name);
177: } else {
178: $this->translations['/' . $alias . '\\(/'] = sprintf('php:functionString(\'%s\', .//', $name);
179: }
180: $this->nativeFunctions[] = $alias;
181: $this->userFunctions[] = $name;
182:
183: $this->xpath->registerPhpFunctions($this->userFunctions);
184: }
185:
186: public function registerNamespace(string $prefix, string $uri): void
187: {
188: $this->xpath->registerNamespace($prefix, $uri);
189: }
190:
191: /**
192: * Find nodes
193: * @param string $query
194: * @param \Dogma\Dom\Element|\DOMNode|null $context
195: * @return \Dogma\Dom\NodeList
196: */
197: public function find(string $query, $context = null): NodeList
198: {
199: $path = $this->translateQuery($query, (bool) $context);
200: if ($context) {
201: $list = $this->xpath->query($path, $context);
202: } else {
203: $list = $this->xpath->query($path);
204: }
205: if ($list === false) {
206: throw new \Dogma\Dom\QueryEngineException(sprintf('Invalid XPath query: \'%s\', translated from: \'%s\'.', $path, $query));
207: }
208:
209: return new NodeList($list, $this);
210: }
211:
212: /**
213: * Find one node
214: * @param string $query
215: * @param \Dogma\Dom\Element|\DOMNode|null $context
216: * @return \DOMNode|\Dogma\Dom\Element|null
217: */
218: public function findOne(string $query, $context = null)
219: {
220: $path = $this->translateQuery($query, (bool) $context);
221: if ($context) {
222: $list = $this->xpath->query($path, $context);
223: } else {
224: $list = $this->xpath->query($path);
225: }
226: if ($list === false) {
227: throw new \Dogma\Dom\QueryEngineException(sprintf('Invalid XPath query: \'%s\', translated from: \'%s\'.', $path, $query));
228: }
229:
230: if (!count($list)) {
231: return null;
232: }
233:
234: return $this->wrap($list->item(0));
235: }
236:
237: /**
238: * Evaluate a query
239: * @param string $query
240: * @param \Dogma\Dom\Element|\DOMNode|null $context
241: * @return string|int|float
242: */
243: public function evaluate(string $query, $context = null)
244: {
245: $path = $this->translateQuery($query, null);
246:
247: if ($context) {
248: $value = $this->xpath->evaluate($path, $context);
249: } else {
250: $value = $this->xpath->evaluate($path);
251: }
252: if ($value === false) {
253: throw new \Dogma\Dom\QueryEngineException(sprintf('Invalid XPath query: \'%s\', translated from: \'%s\'.', $path, $query));
254: }
255:
256: if (substr($query, 0, 5) === 'date(') {
257: return $value ? new \Dogma\Time\Date($value) : null;
258:
259: } elseif (substr($query, 0, 9) === 'datetime(') {
260: return $value ? new \Dogma\Time\DateTime($value) : null;
261:
262: } elseif (substr($query, 0, 4) === 'int(') {
263: if (!is_numeric($value)) {
264: return null;
265: }
266: return (int) $value;
267:
268: } elseif (substr($query, 0, 5) === 'bool(' && isset($value)) {
269: if ($value === '') {
270: return null;
271: }
272: return (bool) $value;
273:
274: } else {
275: return $value;
276: }
277: }
278:
279: /**
280: * Extract values from paths defined by one or more queries
281: * @param string|string[] $queries
282: * @param \Dogma\Dom\Element|\DOMNode|null $context
283: * @return string|string[]
284: */
285: public function extract($queries, $context = null)
286: {
287: if (is_string($queries)) {
288: return $this->extractPath($queries, $context);
289: }
290:
291: $value = [];
292: foreach ($queries as $i => $query) {
293: if (is_array($query)) {
294: $value[$i] = $this->extract($query, $context);
295: } else {
296: $value[$i] = $this->extractPath($query, $context);
297: }
298: }
299: return $value;
300: }
301:
302: // internals -------------------------------------------------------------------------------------------------------
303:
304: /**
305: * @param string $query
306: * @param \Dogma\Dom\Element|\DOMNode $context
307: * @return string|int|float|\DateTime|null
308: */
309: private function extractPath(string $query, $context)
310: {
311: if (Str::match($query, '/^[a-zA-Z0-9_-]+\\(/')) {
312: $node = $this->evaluate($query, $context);
313: } else {
314: $node = $this->findOne($query, $context);
315: }
316:
317: if (is_scalar($node) || $node instanceof \DateTime) {
318: return $node;
319:
320: } elseif (!$node) {
321: return null;
322:
323: } elseif ($node instanceof \DOMAttr) {
324: return $node->value;
325:
326: } elseif ($node instanceof \DOMText) {
327: return $node->wholeText;
328:
329: } elseif ($node instanceof \DOMCdataSection || $node instanceof \DOMComment || $node instanceof \DOMProcessingInstruction) {
330: return $node->data;
331:
332: } else {
333: return $node->textContent;
334: }
335: }
336:
337: private function translateQuery(string $query, bool $context = false): string
338: {
339: if ($context === true) {
340: if ($query[0] === '/') {
341: $query = '.' . $query;
342: } elseif ($query[0] !== '.') {
343: $query = './/' . $query;
344: }
345: } elseif ($context === false) {
346: if ($query[0] !== '/') {
347: $query = '//' . $query;
348: }
349: }
350:
351: $query = Str::replace($query, $this->translations);
352:
353: // adding ".//" before element names
354: $query = Str::replace($query, '@(?<=\\()([0-9A-Za-z_:]+)(?!\\()@', './/$1');
355:
356: // fixing ".//" before function names
357: $query = Str::replace($query, '@\\.//([0-9A-Za-z_:-]+)\\(@', '$1(');
358:
359: $nativeFunctions = $this->nativeFunctions;
360: $userFunctions = $this->userFunctions;
361: $query = Str::replace(
362: $query,
363: '/(?<![A-Za-z0-9_-])([A-Za-z0-9_-]+)\\(/',
364: function ($match) use ($nativeFunctions, $userFunctions) {
365: if (in_array($match[1], $nativeFunctions)) {
366: return $match[1] . '(';
367:
368: } elseif (in_array($match[1], $userFunctions)) {
369: return sprintf('php:functionString(\'%s\', ', $match[1]);
370:
371: } else {
372: throw new \DOMException(sprintf('XPath compilation failure: Functions \'%s\' is not enabled.', $match[1]));
373: }
374: }
375: );
376:
377: return $query;
378: }
379:
380: /**
381: * Wrap element in DomElement object
382: * @param \DOMNode $node
383: * @return \Dogma\Dom\Element|\DOMNode
384: */
385: private function wrap(\DOMNode $node)
386: {
387: if ($node instanceof \DOMElement) {
388: return new Element($node, $this);
389: } else {
390: return $node;
391: }
392: }
393:
394: // extension functions ---------------------------------------------------------------------------------------------
395:
396: /**
397: * Test with regular expression and return matching string
398: * @param string $string
399: * @param string $pattern
400: * @return string|null
401: */
402: public static function match(string $string, string $pattern): ?string
403: {
404: $match = Str::match($string, $pattern);
405: if ($match) {
406: return $match[0];
407: }
408:
409: return null;
410: }
411:
412: public static function replace(string $string, string $pattern, string $replacement): string
413: {
414: return Str::replace($string, $pattern, $replacement);
415: }
416:
417: public static function date(string $string, string $format = 'Y-m-d'): string
418: {
419: if (!$string) {
420: return '';
421: }
422:
423: $date = DateTime::createFromFormat($format, $string);
424: if (!$date) {
425: throw new \Dogma\Dom\QueryEngineException(
426: sprintf('Cannot create DateTime object from \'%s\' using format \'%s\'.', $string, $format)
427: );
428: }
429:
430: return $date->format('Y-m-d');
431: }
432:
433: public static function datetime(string $string, string $format = 'Y-m-d H:i:s'): string
434: {
435: if (!$string) {
436: return '';
437: }
438:
439: $date = DateTime::createFromFormat($format, $string);
440: if (!$date) {
441: throw new \Dogma\Dom\QueryEngineException(
442: sprintf('Cannot create DateTime object from \'%s\' using format \'%s\'.', $string, $format)
443: );
444: }
445:
446: return $date->format('Y-m-d H:i:s');
447: }
448:
449: /**
450: * @param string $string
451: * @param string $true
452: * @param string $false
453: * @return bool|null
454: */
455: public static function bool(string $string, string $true = 'true', string $false = 'false'): ?bool
456: {
457: $string = strtoupper($string);
458: if ($string === $false) {
459: return false;
460: }
461: if ($string === $true) {
462: return true;
463: }
464:
465: return null;
466: }
467:
468: }
| 0 % | Email\EmailAddress.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Email;
11:
12: use Dogma\Web\Domain;
13: use Dogma\Web\Tld;
14:
15: class EmailAddress
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var string */
20: private $address;
21:
22: public function __construct(string $address)
23: {
24: $this->address = $address;
25: }
26:
27: public static function validate(string $address): bool
28: {
29: return preg_match('~^[a-z0-9-!#\$%&\'*+/=?^_`{|}\~]+(?:[.][a-z0-9-!#\$%&\'*+/=?^_`{|}\~]+)*@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?[.])+[a-z]{2,6}$~iu', $address);
30: }
31:
32: public function getDomain(): Domain
33: {
34: $parts = explode('@', $this->address);
35:
36: return new Domain(end($parts));
37: }
38:
39: public function getTld(): Tld
40: {
41: $parts = explode('.', $this->address);
42:
43: return Tld::get(end($parts));
44: }
45:
46: }
| 0 % | Email\EmailAddressAndName.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Email;
11:
12: class EmailAddressAndName
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var \Dogma\Email\EmailAddress */
17: private $address;
18:
19: /** @var string */
20: private $name;
21:
22: public function __construct(EmailAddress $address, ?string $name = null)
23: {
24: $this->address = $address;
25: $this->name = $name;
26: }
27:
28: public function getAddress(): EmailAddress
29: {
30: return $this->address;
31: }
32:
33: public function getName(): string
34: {
35: return $this->name;
36: }
37:
38: public function serialize(): string
39: {
40: return $this->name ? sprintf('"%s" <%s>', $this->name, $this->address) : $this->address;
41: }
42:
43: }
| 0 % | Email\EmailHeader.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Email;
11:
12: class EmailHeader extends \Dogma\Enum\PartialStringEnum
13: {
14:
15: // IETF
16: public const ACCEPT_LANGUAGE = 'Accept-Language';
17: public const ALTERNATE_RECIPIENT = 'Alternate-Recipient';
18: public const ARCHIVED_AT = 'Archived-At';
19: public const AUTHENTICATION_RESULTS = 'Authentication-Results';
20: public const AUTO_SUBMITTED = 'Auto-Submitted';
21: public const AUTOFORWARDED = 'Autoforwarded';
22: public const AUTOSUBMITTED = 'Autosubmitted';
23: public const BCC = 'Bcc';
24: public const CC = 'Cc';
25: public const COMMENTS = 'Comments';
26: public const CONTENT_IDENTIFIER = 'Content-Identifier';
27: public const CONTENT_RETURN = 'Content-Return';
28: public const CONVERSION = 'Conversion';
29: public const CONVERSION_WITH_LOSS = 'Conversion-With-Loss';
30: public const DL_EXPANSION_HISTORY = 'DL-Expansion-History';
31: public const DATE = 'Date';
32: public const DEFERRED_DELIVERY = 'Deferred-Delivery';
33: public const DELIVERY_DATE = 'Delivery-Date';
34: public const DISCARDED_X400_IPMS_EXTENSIONS = 'Discarded-X400-IPMS-Extensions';
35: public const DISCARDED_X400_MTS_EXTENSIONS = 'Discarded-X400-MTS-Extensions';
36: public const DISCLOSE_RECIPIENTS = 'Disclose-Recipients';
37: public const DISPOSITION_NOTIFICATION_OPTIONS = 'Disposition-Notification-Options';
38: public const DISPOSITION_NOTIFICATION_TO = 'Disposition-Notification-To';
39: public const DKIM_SIGNATURE = 'DKIM-Signature';
40: public const DOWNGRADED_FINAL_RECIPIENT = 'Downgraded-Final-Recipient';
41: public const DOWNGRADED_IN_REPLY_TO = 'Downgraded-In-Reply-To';
42: public const DOWNGRADED_MESSAGE_ID = 'Downgraded-Message-Id';
43: public const DOWNGRADED_ORIGINAL_RECIPIENT = 'Downgraded-Original-Recipient';
44: public const DOWNGRADED_REFERENCES = 'Downgraded-References';
45: public const ENCODING = 'Encoding';
46: public const ENCRYPTED = 'Encrypted';
47: public const EXPIRES = 'Expires';
48: public const EXPIRY_DATE = 'Expiry-Date';
49: public const FROM = 'From';
50: public const GENERATE_DELIVERY_REPORT = 'Generate-Delivery-Report';
51: public const IMPORTANCE = 'Importance';
52: public const IN_REPLY_TO = 'In-Reply-To';
53: public const INCOMPLETE_COPY = 'Incomplete-Copy';
54: public const KEYWORDS = 'Keywords';
55: public const LANGUAGE = 'Language';
56: public const LATEST_DELIVERY_TIME = 'Latest-Delivery-Time';
57: public const LIST_ARCHIVE = 'List-Archive';
58: public const LIST_HELP = 'List-Help';
59: public const LIST_ID = 'List-ID';
60: public const LIST_OWNER = 'List-Owner';
61: public const LIST_POST = 'List-Post';
62: public const LIST_SUBSCRIBE = 'List-Subscribe';
63: public const LIST_UNSUBSCRIBE = 'List-Unsubscribe';
64: public const LIST_UNSUBSCRIBE_POST = 'List-Unsubscribe-Post';
65: public const MESSAGE_CONTEXT = 'Message-Context';
66: public const MESSAGE_ID = 'Message-ID';
67: public const MESSAGE_TYPE = 'Message-Type';
68: public const MT_PRIORITY = 'MT-Priority';
69: public const OBSOLETES = 'Obsoletes';
70: public const ORGANIZATION = 'Organization';
71: public const ORIGINAL_ENCODED_INFORMATION_TYPES = 'Original-Encoded-Information-Types';
72: public const ORIGINAL_FROM = 'Original-From';
73: public const ORIGINAL_MESSAGE_ID = 'Original-Message-ID';
74: public const ORIGINAL_RECIPIENT = 'Original-Recipient';
75: public const ORIGINATOR_RETURN_ADDRESS = 'Originator-Return-Address';
76: public const ORIGINAL_SUBJECT = 'Original-Subject';
77: public const PICS_LABEL = 'PICS-Label';
78: public const PREVENT_NONDELIVERY_REPORT = 'Prevent-NonDelivery-Report';
79: public const PRIORITY = 'Priority';
80: public const RECEIVED = 'Received';
81: public const RECEIVED_SPF = 'Received-SPF';
82: public const REFERENCES = 'References';
83: public const REPLY_BY = 'Reply-By';
84: public const REPLY_TO = 'Reply-To';
85: public const REQUIRE_RECIPIENT_VALID_SINCE = 'Require-Recipient-Valid-Since';
86: public const RESENT_BCC = 'Resent-Bcc';
87: public const RESENT_CC = 'Resent-Cc';
88: public const RESENT_DATE = 'Resent-Date';
89: public const RESENT_FROM = 'Resent-From';
90: public const RESENT_MESSAGE_ID = 'Resent-Message-ID';
91: public const RESENT_SENDER = 'Resent-Sender';
92: public const RESENT_TO = 'Resent-To';
93: public const RETURN_PATH = 'Return-Path';
94: public const SENDER = 'Sender';
95: public const SENSITIVITY = 'Sensitivity';
96: public const SOLICITATION = 'Solicitation';
97: public const SUBJECT = 'Subject';
98: public const SUPERSEDES = 'Supersedes';
99: public const TO = 'To';
100: public const VBR_INFO = 'VBR-Info';
101: public const X400_CONTENT_IDENTIFIER = 'X400-Content-Identifier';
102: public const X400_CONTENT_RETURN = 'X400-Content-Return';
103: public const X400_CONTENT_TYPE = 'X400-Content-Type';
104: public const X400_MTS_IDENTIFIER = 'X400-MTS-Identifier';
105: public const X400_ORIGINATOR = 'X400-Originator';
106: public const X400_RECEIVED = 'X400-Received';
107: public const X400_RECIPIENTS = 'X400-Recipients';
108: public const X400_TRACE = 'X400-Trace';
109:
110: // MIME
111: public const BASE = 'Base';
112: public const CONTENT_ALTERNATIVE = 'Content-Alternative';
113: public const CONTENT_BASE = 'Content-Base';
114: public const CONTENT_DESCRIPTION = 'Content-Description';
115: public const CONTENT_DISPOSITION = 'Content-Disposition';
116: public const CONTENT_DURATION = 'Content-Duration';
117: public const CONTENT_FEATURES = 'Content-features';
118: public const CONTENT_ID = 'Content-ID';
119: public const CONTENT_LANGUAGE = 'Content-Language';
120: public const CONTENT_LOCATION = 'Content-Location';
121: public const CONTENT_MD5 = 'Content-MD5';
122: public const CONTENT_TRANSFER_ENCODING = 'Content-Transfer-Encoding';
123: public const CONTENT_TYPE = 'Content-Type';
124: public const MIME_VERSION = 'MIME-Version';
125:
126: // MMHS
127: public const MMHS_EXEMPTED_ADDRESS = 'MMHS-Exempted-Address';
128: public const MMHS_EXTENDED_AUTHORISATION_INFO = 'MMHS-Extended-Authorisation-Info';
129: public const MMHS_SUBJECT_INDICATOR_CODES = 'MMHS-Subject-Indicator-Codes';
130: public const MMHS_HANDLING_INSTRUCTIONS = 'MMHS-Handling-Instructions';
131: public const MMHS_MESSAGE_INSTRUCTIONS = 'MMHS-Message-Instructions';
132: public const MMHS_CODRESS_MESSAGE_INDICATOR = 'MMHS-Codress-Message-Indicator';
133: public const MMHS_ORIGINATOR_REFERENCE = 'MMHS-Originator-Reference';
134: public const MMHS_PRIMARY_PRECEDENCE = 'MMHS-Primary-Precedence';
135: public const MMHS_COPY_PRECEDENCE = 'MMHS-Copy-Precedence';
136: public const MMHS_MESSAGE_TYPE = 'MMHS-Message-Type';
137: public const MMHS_OTHER_RECIPIENTS_INDICATOR_TO = 'MMHS-Other-Recipients-Indicator-To';
138: public const MMHS_OTHER_RECIPIENTS_INDICATOR_CC = 'MMHS-Other-Recipients-Indicator-CC';
139: public const MMHS_ACP127_MESSAGE_IDENTIFIER = 'MMHS-Acp127-Message-Identifier';
140: public const MMHS_ORIGINATOR_PLAD = 'MMHS-Originator-PLAD';
141:
142: // non-standard
143: public const APPARENTLY_TO = 'Apparently-To';
144: public const DELIVERED_TO = 'Delivered-To';
145: public const EDIINT_FEATURES = 'EDIINT-Features';
146: public const EESST_VERSION = 'Eesst-Version';
147: public const ERRORS_TO = 'Errors-To';
148: public const JABBER_ID = 'Jabber-ID';
149: public const MMHS_AUTHORIZING_USERS = 'MMHS-Authorizing-Users';
150: public const PRIVICON = 'Privicon';
151: public const SIO_LABEL = 'SIO-Label';
152: public const SIO_LABEL_HISTORY = 'SIO-Label-History';
153: public const X_ARCHIVED_AT = 'X-Archived-At';
154: public const X_AUTO_RESPONSE_SUPPRESS = 'X-Auto-Response-Suppress';
155: public const X_MAILER = 'X-Mailer';
156: public const X_RECEIVED = 'X-Received';
157:
158: // obsolete
159: /** @deprecated */
160: public const DOWNGRADED_BCC = 'Downgraded-Bcc';
161: /** @deprecated */
162: public const DOWNGRADED_CC = 'Downgraded-Cc';
163: /** @deprecated */
164: public const DOWNGRADED_DISPOSITION_NOTIFICATION_TO = 'Downgraded-Disposition-Notification-To';
165: /** @deprecated */
166: public const DOWNGRADED_FROM = 'Downgraded-From';
167: /** @deprecated */
168: public const DOWNGRADED_MAIL_FROM = 'Downgraded-Email-From';
169: /** @deprecated */
170: public const DOWNGRADED_RCPT_TO = 'Downgraded-Rcpt-To';
171: /** @deprecated */
172: public const DOWNGRADED_REPLY_TO = 'Downgraded-Reply-To';
173: /** @deprecated */
174: public const DOWNGRADED_RESENT_BCC = 'Downgraded-Resent-Bcc';
175: /** @deprecated */
176: public const DOWNGRADED_RESENT_CC = 'Downgraded-Resent-Cc';
177: /** @deprecated */
178: public const DOWNGRADED_RESENT_FROM = 'Downgraded-Resent-From';
179: /** @deprecated */
180: public const DOWNGRADED_RESENT_REPLY_TO = 'Downgraded-Resent-Reply-To';
181: /** @deprecated */
182: public const DOWNGRADED_RESENT_SENDER = 'Downgraded-Resent-Sender';
183: /** @deprecated */
184: public const DOWNGRADED_RESENT_TO = 'Downgraded-Resent-To';
185: /** @deprecated */
186: public const DOWNGRADED_RETURN_PATH = 'Downgraded-Return-Path';
187: /** @deprecated */
188: public const DOWNGRADED_SENDER = 'Downgraded-Sender';
189: /** @deprecated */
190: public const DOWNGRADED_TO = 'Downgraded-To';
191: /** @deprecated */
192: public const RESENT_REPLY_TO = 'Resent-Reply-To';
193:
194: /** @var string[] */
195: private static $exceptions = [
196: 'dl-expansion-history' => 'DL-Expansion-History',
197: 'discarded-x400-ipms-extensions' => 'Discarded-X400-IPMS-Extensions',
198: 'discarded-x400-mts-extensions' => 'Discarded-X400-MTS-Extensions',
199: 'dkim-signature' => 'DKIM-Signature',
200: 'list-id' => 'List-ID',
201: 'message-id' => 'Message-ID',
202: 'mt-priority' => 'MT-Priority',
203: 'original-message-id' => 'Original-Message-ID',
204: 'pics-label' => 'PICS-Label',
205: 'prevent-nondelivery-report' => 'Prevent-NonDelivery-Report',
206: 'received-spf' => 'Received-SPF',
207: 'resent-message-id' => 'Resent-Message-ID',
208: 'vbr-info' => 'VBR-Info',
209: 'x400-mts-identifier' => 'X400-MTS-Identifier',
210: 'mime-version' => 'MIME-Version',
211: 'mmhs-exempted-address' => 'MMHS-Exempted-Address',
212: 'mmhs-extended-authorisation-info' => 'MMHS-Extended-Authorisation-Info',
213: 'mmhs-subject-indicator-codes' => 'MMHS-Subject-Indicator-Codes',
214: 'mmhs-handling-instructions' => 'MMHS-Handling-Instructions',
215: 'mmhs-message-instructions' => 'MMHS-Message-Instructions',
216: 'mmhs-codress-message-indicator' => 'MMHS-Codress-Message-Indicator',
217: 'mmhs-originator-reference' => 'MMHS-Originator-Reference',
218: 'mmhs-primary-precedence' => 'MMHS-Primary-Precedence',
219: 'mmhs-copy-precedence' => 'MMHS-Copy-Precedence',
220: 'mmhs-message-type' => 'MMHS-Message-Type',
221: 'mmhs-other-recipients-indicator-to' => 'MMHS-Other-Recipients-Indicator-To',
222: 'mmhs-other-recipients-indicator-cc' => 'MMHS-Other-Recipients-Indicator-CC',
223: 'mmhs-acp127-message-identifier' => 'MMHS-Acp127-Message-Identifier',
224: 'mmhs-originator-plad' => 'MMHS-Originator-PLAD',
225: 'ediint-features' => 'EDIINT-Features',
226: 'jabber-id' => 'Jabber-ID',
227: 'mmhs-authorizing-users' => 'MMHS-Authorizing-Users',
228: 'sio-label' => 'SIO-Label',
229: 'sio-label-history' => 'SIO-Label-History',
230: ];
231:
232: public static function normalizeName(string $name): string
233: {
234: $name = strtolower($name);
235:
236: if (isset(self::$exceptions[$name])) {
237: return self::$exceptions[$name];
238: }
239:
240: return implode('-', array_map('ucfirst', explode('-', $name)));
241: }
242:
243: public static function validateValue(string &$value): bool
244: {
245: $value = self::normalizeName($value);
246:
247: return parent::validateValue($value);
248: }
249:
250: public static function getValueRegexp(): string
251: {
252: return '(?:X-)?[A-Z][a-z]+(?:[A-Z][a-z]+)*|' . implode('|', self::$exceptions);
253: }
254:
255: }
| 0 % | Email\Imap\Connection.php |
<?php
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Email\Imap;
11:
12: use Dogma\Email\Parse\Message;
13:
14: class Connection
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: public const DEFAULT_PORT = 143;
19:
20: /** @var int */
21: public static $connectionRetries = 1;
22:
23: /** @var string */
24: private $tempDir;
25:
26: /** @var resource */
27: private $handler;
28:
29: /** @var string */
30: private $ref;
31:
32: /** @var string */
33: private $host;
34:
35: /** @var int */
36: private $port;
37:
38: /** @var bool */
39: private $ssl;
40:
41: /** @var string */
42: private $user;
43:
44: /** @var string */
45: private $password;
46:
47: /** @var string */
48: private $selectedFolder;
49:
50: /** @var \Dogma\Email\Imap\Folder[] */
51: private $folders = [];
52:
53: /** @var \Dogma\Email\Imap\MessageInfo[] */
54: private $messages = [];
55:
56: /** @var string[] cache of subscribed folders */
57: private $subscribed;
58:
59: public function __construct(
60: string $tempDir,
61: string $user,
62: string $password,
63: string $host,
64: int $port = self::DEFAULT_PORT,
65: bool $ssl = false
66: ) {
67: $this->tempDir = $tempDir;
68: $this->user = $user;
69: $this->password = $password;
70: $this->host = $host;
71: $this->port = $port;
72: $this->ssl = $ssl;
73: }
74:
75: public function connect(): void
76: {
77: $params = $this->ssl ? '/ssl/novalidate-cert' : ''; // /ssl/secure
78:
79: $options = 0;
80: if (!$this->selectedFolder) {
81: $options |= OP_HALFOPEN;
82: }
83:
84: ///
85: $this->handler = imap_open(
86: sprintf('{%s:%s%s}%s', $this->host, $this->port, $params, $this->selectedFolder),
87: $this->user,
88: $this->password,
89: $options,
90: self::$connectionRetries
91: );
92: ///
93: if (!$this->handler) {
94: throw new \Dogma\Email\Imap\ImapException(sprintf('Cannot connect to server: %s', imap_last_error()));
95: }
96:
97: $this->ref = sprintf('{%s:%s}', $this->host, $this->port);
98: }
99:
100: public function isConnected(): bool
101: {
102: if (!$this->handler) {
103: return false;
104: }
105:
106: ///
107: return imap_ping($this->handler);
108: ///
109: }
110:
111: public function disconnect(): void
112: {
113: ///
114: $res = imap_close($this->handler, CL_EXPUNGE);
115: ///
116: if (!$res) {
117: throw new \Dogma\Email\Imap\ImapException('Error when disconnecting from server: ' . imap_last_error());
118: }
119: }
120:
121: /**
122: * @return int[]
123: */
124: public function getQuota(): array
125: {
126: ///
127: $q = imap_get_quotaroot($this->handler, 'INBOX');
128: ///
129:
130: return [$q['storage']];
131: }
132:
133: // folders ---------------------------------------------------------------------------------------------------------
134:
135: /**
136: * Get tree structure of folders in mailbox
137: * @param string $filter
138: * @param bool $all
139: * @return string[]
140: */
141: public function getFolderStructure(string $filter = '*', bool $all = true): array
142: {
143: $folders = $this->listFolders($filter, $all);
144: $struct = [];
145:
146: foreach ($folders as &$folder) {
147: $parts = explode('/', $folder);
148: $n = -1;
149: $branch = &$struct;
150: while (isset($parts[++$n])) {
151: if (!isset($branch[$parts[$n]])) {
152: $branch[$parts[$n]] = [];
153: }
154: $branch = &$branch[$parts[$n]];
155: }
156: }
157:
158: return $struct;
159: }
160:
161: /**
162: * Return list of folders in mailbox
163: * @param string $filter
164: * @param bool $all
165: * @return string[]
166: */
167: public function listFolders(string $filter = '*', bool $all = true): array
168: {
169: ///
170: if ($all) {
171: $folders = imap_list($this->handler, $this->ref, $filter);
172: } else {
173: $folders = imap_lsub($this->handler, $this->ref, $filter);
174: }
175: ///
176:
177: foreach ($folders as &$folder) {
178: $folder = preg_replace('/^Inbox(?=\\W)/i', 'INBOX', substr($this->decode($folder), strlen($this->ref)));
179: }
180: sort($folders);
181:
182: return $folders;
183: }
184:
185: /**
186: * Get info about folders
187: * @param string $filter
188: * @param bool $all
189: * @return \Dogma\Email\Imap\Folder[]
190: */
191: public function getFolders(string $filter = '*', bool $all = true): array
192: {
193: ///
194: if ($all) {
195: $folders = imap_getmailboxes($this->handler, $this->ref, $filter);
196: } else {
197: $folders = imap_getsubscribed($this->handler, $this->ref, $filter);
198: }
199: ///
200:
201: $info = [];
202: foreach ($folders as &$folder) {
203: $name = preg_replace('/^Inbox(?=\\W)/i', 'INBOX', substr($this->decode($folder->name), strlen($this->ref)));
204:
205: if (empty($this->folders[$name])) {
206: $this->folders[$name] = new Folder($this, $name, $folder->attributes);
207: }
208: $info[$name] = $this->folders[$name];
209: }
210: ksort($info);
211:
212: return array_values($info);
213: }
214:
215: /**
216: * Get IMAP folder status.
217: * @param string $name
218: * @return object
219: */
220: public function getFolderStatus(string $name)
221: {
222: ///
223: return imap_status($this->handler, $this->ref . $this->encode($name), SA_ALL);
224: ///
225: }
226:
227: /**
228: * Get IMAP folder info.
229: * @param string $name
230: * @return object
231: */
232: public function getFolderInfo(string $name)
233: {
234: if ($name !== $this->selectedFolder) {
235: throw new \Nette\InvalidStateException('Folder must be open to read info.');
236: }
237:
238: ///
239: return imap_mailboxmsginfo($this->handler);
240: ///
241: }
242:
243: // subscriptions ---------------------------------------------------------------------------------------------------
244:
245: /**
246: * Return list of subscribed folders in mailbox
247: * @param string $filter
248: * @return string[]
249: */
250: public function listSubscribedFolders(string $filter = '*'): array
251: {
252: if ($filter === '*') {
253: if (!$this->subscribed) {
254: $this->subscribed = $this->listFolders('*', false);
255: }
256: return $this->subscribed;
257: }
258:
259: return $this->listFolders($filter, false);
260: }
261:
262: /**
263: * Return list of unsubscribed folders in mailbox
264: * @param string $filter
265: * @return string[]
266: */
267: public function listUnsubscribedFolders(string $filter = '*'): array
268: {
269: $all = $this->listFolders($filter);
270: $sub = $this->listFolders($filter, false);
271:
272: return array_diff($all, $sub);
273: }
274:
275: public function subscribeFolder(string $path): void
276: {
277: ///
278: imap_subscribe($this->handler, $this->ref . $this->encode($path));
279: ///
280: }
281:
282: public function unsubscribeFolder(string $path): void
283: {
284: ///
285: imap_unsubscribe($this->handler, $this->ref . $this->encode($path));
286: ///
287: }
288:
289: public function isFolderSubscribed(string $name): bool
290: {
291: if (!$this->subscribed) {
292: $this->subscribed = $this->listFolders('*', false);
293: }
294:
295: return in_array($name, $this->subscribed);
296: }
297:
298: // folder manipulation ---------------------------------------------------------------------------------------------
299:
300: /**
301: * Select folder and return a Folder object
302: * @param string $name
303: * @return \Dogma\Email\Imap\Folder
304: */
305: public function selectFolder(string $name): Folder
306: {
307: ///
308: imap_reopen($this->handler, $this->ref . $this->encode($name), 0, self::$connectionRetries);
309: ///
310: $this->selectedFolder = $name;
311:
312: if (isset($this->folders[$name])) {
313: return $this->folders[$name];
314: }
315:
316: ///
317: $f = imap_getmailboxes($this->handler, $this->ref, $name);
318: ///
319: return $this->folders[$name] = new Folder($this, $name, $f[0]->attributes);
320: }
321:
322: public function getSelectedFolder(): ?string
323: {
324: return $this->selectedFolder;
325: }
326:
327: public function createFolder(string $path): void
328: {
329: ///
330: imap_createmailbox($this->handler, $this->ref . $this->encode($path));
331: ///
332: }
333:
334: public function deleteFolder(string $path): void
335: {
336: ///
337: imap_deletemailbox($this->handler, $this->ref . $this->encode($path));
338: ///
339: }
340:
341: public function renameFolder(string $oldPath, string $newPath): void
342: {
343: ///
344: imap_renamemailbox($this->handler, $this->ref . $this->encode($oldPath), $this->ref . $this->encode($newPath));
345: ///
346: }
347:
348: // messages --------------------------------------------------------------------------------------------------------
349:
350: /**
351: * Get list of messages from current folder.
352: * @param mixed[] $criteria
353: * @param string $orderBy (date|arrival|from|subject|to|cc|size)
354: * @param bool $descending
355: * @return \Dogma\Email\Parse\Message[]
356: */
357: public function getMessages(array $criteria = [], ?string $orderBy = null, bool $descending = false): array
358: {
359: static $ob = [
360: 'date' => SORTDATE,
361: 'arrival' => SORTARRIVAL,
362: 'from' => SORTFROM,
363: 'subject' => SORTSUBJECT,
364: 'to' => SORTTO,
365: 'cc' => SORTCC,
366: 'size' => SORTSIZE,
367: ];
368:
369: $criteria = $criteria === [] ? 'ALL' : $this->compileCriteria($criteria);
370:
371: if ($orderBy) {
372: if (!isset($ob[$orderBy])) {
373: throw new \InvalidArgumentException(sprintf('Unknown sort criterion: %s', $orderBy));
374: }
375:
376: $uids = imap_sort($this->handler, $ob[$orderBy], ($descending ? 1 : 0), SE_UID, $criteria, 'UTF-8');
377: } else {
378: $uids = imap_search($this->handler, $criteria, SE_UID, 'UTF-8');
379: }
380: $errors = imap_errors();
381: if (!$uids && $errors) {
382: throw new \Dogma\Email\Imap\ImapException('IMAP search failed: ' . implode('; ', $errors));
383: }
384:
385: $messages = [];
386: foreach ($uids as $uid) {
387: if (empty($this->messages[$uid])) {
388: $this->messages[$uid] = new MessageInfo($this, $uid);
389: }
390: $messages[$uid] = $this->messages[$uid];
391: }
392:
393: return array_values($messages);
394: }
395:
396: /**
397: * Compile IMAP search criteria
398: *
399: * http://www.afterlogic.com/mailbee-net/docs/MailBee.ImapMail.Imap.Search_overload_1.html
400: * @param mixed[] $criteria
401: * @return string
402: */
403: private function compileCriteria(array $criteria): string
404: {
405: static $true = ['OLD', 'NEW', 'RECENT']; // NEW = RECENT & UNSEEN; OLD = NOT RECENT;
406: static $bool = ['ANSWERED', 'DELETED', 'FLAGGED', 'SEEN'/*, 'DRAFT'*/];
407: static $text = ['SUBJECT', 'BODY', 'TEXT', 'FROM', 'TO', 'CC', 'BCC'];
408: static $date = ['ON', 'SINCE', 'BEFORE'/*, 'SENTON', 'SENTSINCE', 'SENTBEFORE'*/];
409: /*static $size = ['LARGER', 'SMALLER'];*/
410: // NOT %1
411: // OR %1 %2
412:
413: $query = [];
414: foreach ($criteria as $name => $value) {
415: $name = strtoupper($name);
416:
417: if (in_array($name, $true)) {
418: $query[] = /*($value ? '' : 'NOT ') . */$name;
419:
420: } elseif (in_array($name, $bool)) {
421: $query[] = ($value ? '' : 'UN') . $name;
422:
423: } elseif (in_array($name, $text)) {
424: $query[] = $name . ' "' . $value . '"';
425:
426: } elseif (in_array($name, $date)) {
427: if (is_string($value)) {
428: $value = new \DateTime($value);
429: }
430: if (!$value instanceof \DateTime) {
431: throw new \InvalidArgumentException(sprintf('Given value of \'%s\' must be a DateTime or string.', $name));
432: }
433: $query[] = $name . ' ' . $value->format('d-M-Y');
434: /*
435: } elseif (in_array($name, $size)) {
436: $query[] = $name . ' ' . $value;
437: */
438: } elseif ($name === 'KEYWORD') {
439: $value = (array) $value;
440: foreach ($value as $keyword) {
441: if ($keyword[0] === '-') {
442: $query[] = 'UNKEYWORD "' . substr($keyword, 1) . '"';
443: } else {
444: $query[] = 'KEYWORD "' . $keyword . '"';
445: }
446: }
447: /*
448: } elseif ($name === 'UID') {
449: $value = (array) $value;
450: $query[] = 'UID "' . implode(',', $value) . '"';
451: */
452: } else {
453: throw new \InvalidArgumentException(sprintf('Unknown search option \'%s\' given.', $name));
454: }
455: }
456:
457: return implode(' ', $query);
458: }
459:
460: public function getMessage(int $uid): Message
461: {
462: return new Message($this->getRawMessageHeader($uid) . "\r\n\r\n" . $this->getMessageBody($uid), $this->tempDir);
463: }
464:
465: public function getMessageBody(int $uid): string
466: {
467: ///
468: return imap_body($this->handler, $uid, FT_UID | FT_PEEK);
469: ///
470: }
471:
472: public function getRawMessageHeader(int $uid): string
473: {
474: ///
475: return imap_fetchheader($this->handler, $uid, FT_UID | FT_PREFETCHTEXT);
476: ///
477: }
478:
479: private function encode(string $str): string
480: {
481: return mb_convert_encoding($str, 'UTF7-IMAP', 'UTF-8');
482: }
483:
484: private function decode(string $str): string
485: {
486: return mb_convert_encoding($str, 'UTF-8', 'UTF7-IMAP');
487: }
488:
489: }
| 0 % | Email\Imap\exceptions\ImapException.php |
<?php
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Email\Imap;
11:
12: class ImapException extends \RuntimeException
13: {
14:
15: ///
16:
17: }
| 0 % | Email\Imap\Folder.php |
<?php
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Email\Imap;
11:
12: class Folder
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: public const NO_SUBFOLDERS = LATT_NOINFERIORS; // 1
17: public const NOT_SELECTABLE = LATT_NOSELECT; // 2
18: public const IS_MARKED = LATT_MARKED; // 4
19: public const IS_UNMARKED = LATT_UNMARKED; // 8
20: public const IS_REFERENCE = LATT_REFERRAL; // 16
21: public const HAS_CHILDREN = LATT_HASCHILDREN; // 32
22: public const HAS_NO_CHILDREN = LATT_HASNOCHILDREN; // 64
23:
24: /** @var \Dogma\Email\Imap\Connection */
25: private $imap;
26:
27: /** @var string */
28: private $name;
29:
30: /** @var int */
31: private $attr;
32:
33: /** @var int */
34: private $messages;
35:
36: /** @var int */
37: private $recent;
38:
39: /** @var int */
40: private $unread;
41:
42: /** @var int */
43: private $deleted;
44:
45: /** @var int */
46: private $size;
47:
48: public function __construct(Connection $imap, string $name, int $attributes)
49: {
50: $this->imap = $imap;
51: $this->name = $name;
52: $this->attr = $attributes;
53: }
54:
55: public function select(): Folder
56: {
57: return $this->imap->selectFolder($this->name);
58: }
59:
60: // info ------------------------------------------------------------------------------------------------------------
61:
62: public function isSelected(): bool
63: {
64: return $this->imap->getSelectedFolder() === $this->name;
65: }
66:
67: public function isSelectable(): bool
68: {
69: return !($this->attr & self::NOT_SELECTABLE);
70: }
71:
72: public function hasSubfolders(): bool
73: {
74: return (bool) $this->attr & self::HAS_CHILDREN;
75: }
76:
77: public function canHaveSubfolders(): bool
78: {
79: return !($this->attr & self::NO_SUBFOLDERS);
80: }
81:
82: public function isSubscribed(): bool
83: {
84: return $this->imap->isFolderSubscribed($this->name);
85: }
86:
87: public function getMessageCount(): int
88: {
89: if (empty($this->messages)) {
90: $this->loadStatus();
91: }
92: return $this->messages;
93: }
94:
95: public function getRecentCount(): int
96: {
97: if (empty($this->recent)) {
98: $this->loadStatus();
99: }
100: return $this->recent;
101: }
102:
103: public function getUnreadCount(): int
104: {
105: if (empty($this->unread)) {
106: $this->loadStatus();
107: }
108: return $this->unread;
109: }
110:
111: public function getDeletedCount(): int
112: {
113: if (empty($this->deleted)) {
114: $this->loadInfo();
115: }
116: return $this->deleted;
117: }
118:
119: public function getSize(): int
120: {
121: if (empty($this->size)) {
122: $this->loadInfo();
123: }
124: return $this->size;
125: }
126:
127: // subfolders ------------------------------------------------------------------------------------------------------
128:
129: /**
130: * @param string $filter
131: * @param bool $all
132: * @return string[]
133: */
134: public function listSubfolders(string $filter = '*', bool $all = true): array
135: {
136: return $this->imap->listFolders($this->name . '/' . $filter, $all);
137: }
138:
139: /**
140: * @param string $filter
141: * @param bool $all
142: * @return \Dogma\Email\Imap\Folder[]
143: */
144: public function getSubfolders(string $filter = '*', bool $all = true): array
145: {
146: return $this->imap->getFolders($this->name . '/' . $filter, $all);
147: }
148:
149: // internals -------------------------------------------------------------------------------------------------------
150:
151: private function loadStatus(): void
152: {
153: $status = $this->imap->getFolderStatus($this->name);
154:
155: $this->messages = $status->messages;
156: $this->recent = $status->recent;
157: $this->unread = $status->unseen;
158: // uidnext
159: // uidvalidity
160: }
161:
162: private function loadInfo(): void
163: {
164: $info = $this->imap->getFolderInfo($this->name);
165:
166: // Date
167: // Driver
168: // Mailbox
169: $this->messages = $info->Nmsgs;
170: $this->recent = $info->Recent;
171: $this->unread = $info->Unread;
172: $this->deleted = $info->Deleted;
173: $this->size = $info->Size;
174: }
175:
176: }
| 0 % | Email\Imap\MessageInfo.php |
<?php
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Email\Imap;
11:
12: use Dogma\Email\Parse\Message;
13:
14: class MessageInfo
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var \Dogma\Email\Imap\Connection */
19: private $imap;
20:
21: /** @var int */
22: private $uid;
23:
24: /** @var \Dogma\Email\Parse\Message */
25: private $message;
26:
27: public function __construct(Connection $imap, int $uid)
28: {
29: $this->imap = $imap;
30: $this->uid = $uid;
31: }
32:
33: public function getMessage(): Message
34: {
35: if (!$this->message) {
36: $this->message = $this->imap->getMessage($this->uid);
37: }
38:
39: return $this->message;
40: }
41:
42: /*public function getBody(): string
43: {
44: return $this->imap->getMessageBody($this->uid);
45: }*/
46:
47: /*public function getRawHeader(): string
48: {
49: return $this->imap->getRawMessageHeader($this->uid);
50: }*/
51:
52: }
| 0 % | Email\Parse\Attachment.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Email\Parse;
11:
12: use Dogma\Io\File;
13:
14: class Attachment
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** Content disposition */
19: public const ATTACHMENT = 'attachment';
20: public const INLINE = 'inline';
21:
22: /** @var string */
23: private $data;
24:
25: /** @var \Dogma\Io\File */
26: private $file;
27:
28: /** @var string[] */
29: private $headers;
30:
31: /** @var string */
32: private $tempDir;
33:
34: /**
35: * @param \Dogma\Io\File|string $data
36: * @param string[] $headers
37: * @param string $tempDir
38: */
39: public function __construct($data, array $headers = [], string $tempDir)
40: {
41: if ($data instanceof File) {
42: $this->file = $data;
43: } else {
44: $this->data = $data;
45: }
46: $this->headers = $headers;
47: $this->tempDir = $tempDir;
48: }
49:
50: public function getFileName(): string
51: {
52: return @$this->headers['disposition-filename']; // not on 'inline'
53: }
54:
55: public function getContentType(): string
56: {
57: return $this->headers['content-type'];
58: }
59:
60: public function getCharset(): string
61: {
62: return @$this->headers['content-charset']; // not on binary
63: }
64:
65: public function getDisposition(): string
66: {
67: return $this->headers['content-disposition'];
68: }
69:
70: /**
71: * @return string[]
72: */
73: public function getHeaders(): array
74: {
75: return $this->headers;
76: }
77:
78: public function getLength(): int
79: {
80: if ($this->data) {
81: return strlen($this->data);
82: } else {
83: return $this->file->getMetaData()->getSize();
84: }
85: }
86:
87: public function getContent(): string
88: {
89: if ($this->data) {
90: return $this->data;
91: } else {
92: return $this->file->getContent();
93: }
94: }
95:
96: public function getFile(): File
97: {
98: if (!$this->file) {
99: $this->file = File::createTemporaryFile($this->tempDir);
100: $this->file->write($this->data);
101: }
102: return $this->file;
103: }
104:
105: }
| 0 % | Email\Parse\exceptions\ParsingException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Email\Parse;
11:
12: class ParsingException extends \Dogma\Exception
13: {
14:
15: //
16:
17: }
| 0 % | Email\Parse\Message.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: // spell-check-ignore: te
11:
12: namespace Dogma\Email\Parse;
13:
14: use Dogma\Email\EmailAddress;
15: use Dogma\Email\EmailAddressAndName;
16: use Dogma\Io\File;
17: use Dogma\Language\Inflector;
18: use Dogma\PowersOfTwo;
19: use Dogma\Str;
20:
21: /**
22: * Mime mail parser. Parses mail message from a File or string.
23: *
24: * @property-read string $subject
25: * @property-read \DateTime $date
26: *
27: * @property-read string $from
28: * @property-read string $to
29: * @property-read string $cc
30: * @property-read string $replyTo
31: *
32: * @property-read string $messageId
33: * @property-read string $inReplyTo
34: */
35: class Message
36: {
37: use \Dogma\StrictBehaviorMixin;
38:
39: public const TEXT = 'text/plain';
40: public const HTML = 'text/html';
41:
42: /** @var int bigger attachments will be treated using temporary files */
43: public static $bigFileThreshold = PowersOfTwo::_1M;
44:
45: /** @var string[] */
46: private $parts = [];
47:
48: /** @var string[] */
49: private $headers;
50:
51: /** @var \Dogma\Io\File */
52: private $file;
53:
54: /** @var string */
55: private $data;
56:
57: /** @var string */
58: private $tempDir;
59:
60: /**
61: * @param string|\Dogma\Io\File $message
62: * @param string $tempDir
63: */
64: public function __construct($message, string $tempDir)
65: {
66: $this->tempDir = $tempDir;
67:
68: if ($message instanceof File) {
69: $this->file = $message;
70: ///
71: $handler = mailparse_msg_parse_file($this->file->getPath());
72: if (!$handler) {
73: throw new \Dogma\Email\Parse\ParsingException('Cannot parse email file.');
74: }
75:
76: } else {
77: ///
78: $handler = mailparse_msg_create();
79: $res = mailparse_msg_parse($handler, $message);
80: if (!$handler || !$res) {
81: throw new \Dogma\Email\Parse\ParsingException('Cannot parse email message.');
82: }
83: $this->data = $message;
84: }
85:
86: ///
87: $structure = mailparse_msg_get_structure($handler);
88: if (!$structure) {
89: throw new \Dogma\Email\Parse\ParsingException('Cannot parse email structure.');
90: }
91:
92: $this->parts = [];
93: foreach ($structure as $partId) {
94: ///
95: $partHandler = mailparse_msg_get_part($handler, $partId);
96: $partData = mailparse_msg_get_part_data($partHandler);
97: if (!$partHandler || !$partData) {
98: throw new \Dogma\Email\Parse\ParsingException('Cannot get email part data.');
99: }
100: $this->parts[$partId] = $partData;
101: }
102:
103: mailparse_msg_free($handler);
104: }
105:
106: /**
107: * Returns all email headers.
108: * @return string[]
109: */
110: public function getHeaders(): array
111: {
112: if (!$this->headers) {
113: $this->headers = $this->parts[1]['headers'];
114: $this->decodeHeaders($this->headers);
115: }
116:
117: return $this->headers;
118: }
119:
120: public function getHeader(string $name): ?string
121: {
122: if (!$this->headers) {
123: $this->getHeaders();
124: }
125:
126: if (isset($this->headers[$name])) {
127: return $this->headers[$name];
128: }
129:
130: return null;
131: }
132:
133: /**
134: * Return content types of body (usually text/plain and text/html).
135: * @return string[]
136: */
137: public function getContentTypes(): array
138: {
139: $ct = [];
140: foreach ($this->parts as $part) {
141: if (isset($part['content-disposition'])) {
142: continue;
143: }
144: if (substr($part['content-type'], 0, 9) === 'multipart') {
145: continue;
146: }
147: }
148:
149: return $ct;
150: }
151:
152: public function getBody(string $type = self::TEXT): ?string
153: {
154: if ($type !== 'text/plain' && $type !== 'text/html') {
155: throw new \Dogma\Email\Parse\ParsingException('Invalid content type specified. Type can either be "text/plain" or "text/html".');
156: }
157:
158: foreach ($this->parts as $part) {
159: if ($type !== $part['content-type']) {
160: continue;
161: }
162: if (isset($part['content-disposition'])) {
163: continue;
164: }
165:
166: return $this->decode($this->getPartBody($part), @$part['headers']['content-transfer-encoding'] ?: '');
167: }
168:
169: return null;
170: }
171:
172: /**
173: * Get the headers for the message body part.
174: * @param string $type
175: * @return string[]
176: */
177: public function getBodyHeaders(string $type = self::TEXT): array
178: {
179: if ($type !== 'text/plain' && $type !== 'text/html') {
180: throw new \Dogma\Email\Parse\ParsingException('Invalid content type specified. Type can either be "text/plain" or "text/html".');
181: }
182:
183: foreach ($this->parts as $part) {
184: if ($type !== $part['content-type']) {
185: continue;
186: }
187:
188: return @$part['headers'] ?: [];
189: }
190:
191: return [];
192: }
193:
194: /**
195: * Returns attachments. May be filtered by mime type.
196: * @param string|string[] $contentType
197: * @param bool $inlined
198: * @return \Dogma\Email\Parse\Attachment[]
199: */
200: public function getAttachments($contentType = null, bool $inlined = true): array
201: {
202: $dispositions = $inlined ? ['attachment', 'inline'] : ['attachment'];
203: if (isset($contentType) && !is_array($contentType)) {
204: $contentType = [$contentType];
205: }
206:
207: $attachments = [];
208: foreach ($this->parts as $part) {
209: if (!in_array(@$part['content-disposition'], $dispositions)) {
210: continue; // only on attachments
211: }
212: if ($contentType && !in_array($part['content-type'], $contentType)) {
213: continue;
214: }
215:
216: $attachments[] = new Attachment(
217: $this->getAttachmentData($part),
218: $this->getParsedPartHeaders($part),
219: $this->tempDir
220: );
221: }
222:
223: return $attachments;
224: }
225:
226: /**
227: * @param string $name
228: * @return string|\DateTime
229: */
230: public function &__get(string $name)
231: {
232: if (!$this->headers) {
233: $this->getHeaders();
234: }
235:
236: $name = Inflector::dasherize(Inflector::underscore($name));
237: $val = isset($this->headers[$name]) ? $this->headers[$name]
238: : (isset($this->headers['x-' . $name]) ? $this->headers['x-' . $name] : null);
239:
240: return $val;
241: }
242:
243: // internals -------------------------------------------------------------------------------------------------------
244:
245: private function decode(string $data, string $encoding): string
246: {
247: if (strtolower($encoding) === 'base64') {
248: return base64_decode($data);
249:
250: } elseif (strtolower($encoding) === 'quoted-printable') {
251: return quoted_printable_decode($data);
252:
253: } elseif (!$encoding) {
254: return $data;
255:
256: } else {
257: throw new \Dogma\Email\Parse\ParsingException('Unknown transfer encoding.');
258: }
259: }
260:
261: /**
262: * Find and decode encoded headers (format: =?charset?te?header?=)
263: * @param string[]|string[][] $headers
264: */
265: private function decodeHeaders(array &$headers): void
266: {
267: foreach ($headers as $name => &$value) {
268: if (is_array($value)) {
269: $this->decodeHeaders($value);
270: continue;
271: }
272:
273: //
274:
275: if (in_array($name, ['date', 'resent-date', 'delivery-date', 'expires'], true)) {
276: $value = new \Dogma\Time\DateTime($value);
277:
278: } elseif (in_array($name, ['from', 'to', 'cc', 'bcc', 'reply-to', 'return-path', 'sender'], true)) {
279: $value = $this->parseAddressHeader($value);
280:
281: } elseif (strpos($value, '=?') !== false) {
282: $value = $this->decodeHeader($value);
283: }
284: }
285: }
286:
287: /**
288: * Parse addresses from mail header (from, to, cc, bcc, reply-to, return-path, delivered-to, sender…)
289: * @param string $header
290: * @return \Dogma\Email\EmailAddressAndName[]
291: */
292: private function parseAddressHeader(string $header): array
293: {
294: $data = mailparse_rfc822_parse_addresses($header);
295:
296: $arr = [];
297: foreach ($data as $item) {
298: list($name, $address, ) = array_values($item);
299:
300: $name = $address === $name ? null
301: : (strpos($name, '=?') !== false ? $this->decodeHeader($name) : $name);
302: $arr[] = new EmailAddressAndName(new EmailAddress($address), $name);
303: }
304:
305: return $arr;
306: }
307:
308: private function decodeHeader(string $header): string
309: {
310: // =?utf-8?q?Test=3a=20P=c5=99=c3=...?=
311: $that = $this;
312: $header = Str::replace($header, '/(=\\?[^?]+\\?[^?]\\?[^?]+\\?=)/', function ($match) use ($that) {
313: list(, $charset, $encoding, $message,) = explode('?', $match[0]);
314:
315: if (strtolower($encoding) === 'b') {
316: $message = base64_decode($message);
317:
318: } elseif (strtolower($encoding) === 'q') {
319: $message = quoted_printable_decode($message);
320:
321: } else {
322: throw new \Dogma\Email\Parse\ParsingException(sprintf('Unknown header encoding \'%s\'.', $encoding));
323: }
324:
325: return $that->convertCharset($message, strtolower($charset));
326: });
327:
328: return $header;
329: }
330:
331: private static function convertCharset(string $string, string $charset): string
332: {
333: if ($charset === 'utf-8') {
334: return $string;
335: }
336:
337: return iconv('utf-8', $charset, $string);
338: }
339:
340: /**
341: * @param string[] $part
342: * @return string[]
343: */
344: private function getParsedPartHeaders(array $part): array
345: {
346: $headers = $part;
347: unset($headers['headers']);
348: unset($headers['starting-pos']);
349: unset($headers['starting-pos-body']);
350: unset($headers['ending-pos']);
351: unset($headers['ending-pos-body']);
352: unset($headers['line-count']);
353: unset($headers['body-line-count']);
354: unset($headers['charset']);
355: unset($headers['transfer-encoding']);
356: unset($headers['content-base']);
357: return $headers;
358: }
359:
360: /**
361: * @param string[] $part
362: * @return string|null
363: */
364: private function getPartBody(array $part): ?string
365: {
366: $start = $part['starting-pos-body'];
367: $length = $part['ending-pos-body'] - $start;
368:
369: if ($this->data) {
370: return substr($this->data, $start, $length);
371: } else {
372: $this->file->setPosition($start);
373: return $this->file->read($length);
374: }
375: }
376:
377: /**
378: * Get attachment data as string or temporary File object.
379: * @param string[] $part
380: * @return string|\Dogma\Io\File
381: */
382: private function getAttachmentData(array $part)
383: {
384: $encoding = array_key_exists('content-transfer-encoding', $part['headers']) ? $part['headers']['content-transfer-encoding'] : '';
385:
386: if ($this->data) {
387: return $this->decode($this->getPartBody($part), $encoding);
388:
389: } else {
390: $start = $part['starting-pos-body'];
391: $length = $part['ending-pos-body'] - $start;
392: $this->file->setPosition($start);
393:
394: if ($length < self::$bigFileThreshold) {
395: return $this->decode($this->file->read($length), $encoding);
396:
397: } else {
398: $temporaryFile = File::createTemporaryFile($this->tempDir);
399:
400: $that = $this;
401:
402: $this->file->copyData(function ($chunk) use ($that, $temporaryFile, $encoding): void {
403: $temporaryFile->write($that->decode($chunk, $encoding));
404: }, $start, $length);
405:
406: $temporaryFile->setPosition(0);
407:
408: return $temporaryFile;
409: }
410: }
411: }
412:
413: }
| 100 % | Entity\Entity.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity;
11:
12: interface Entity
13: {
14:
15: public function getIdentity(): Identity;
16:
17: }
| 0 % | Entity\exceptions\EntityNotFoundException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity;
11:
12: class EntityNotFoundException extends \Dogma\Exception implements \Dogma\Entity\Exception
13: {
14:
15: public function __construct(Identity $identity, string $entityClass, ?\Throwable $previous = null)
16: {
17: parent::__construct(sprintf('Entity id %d of class \'%s\' was not found.', $identity->getId(), $entityClass), $previous);
18: }
19:
20: }
| 0 % | Entity\exceptions\Exception.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity;
11:
12: interface Exception
13: {
14:
15: }
| 0 % | Entity\exceptions\IdentityNotFoundInIdentityMapException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity;
11:
12: use Dogma\Entity\Map\IdentityMap;
13: use Dogma\ExceptionValueFormatter;
14:
15: class IdentityNotFoundInIdentityMapException extends \Dogma\Exception implements \Dogma\Entity\Exception
16: {
17:
18: public function __construct(Identity $identity, IdentityMap $identityMap, ?\Throwable $previous = null)
19: {
20: parent::__construct(sprintf(
21: '%s was not found in %s.',
22: ExceptionValueFormatter::format($identity),
23: ExceptionValueFormatter::format($identityMap)
24: ), $previous);
25: }
26:
27: }
| 0 % | Entity\exceptions\RepositoryNotFoundException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity;
11:
12: class RepositoryNotFoundException extends \Dogma\Exception implements \Dogma\Entity\Exception
13: {
14:
15: public function __construct(string $entityClass, ?\Throwable $previous = null)
16: {
17: parent::__construct(sprintf('Repository for entities of class \'%s\' is not registered.', $entityClass), $previous);
18: }
19:
20: }
| 93 % | Entity\Identity.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity;
11:
12: use Dogma\Check;
13: use Dogma\Entity\Map\IdentityMap;
14: use Dogma\Type;
15:
16: /**
17: * Identity
18: */
19: abstract class Identity
20: {
21: use \Dogma\StrictBehaviorMixin;
22: use \Dogma\NonCloneableMixin;
23: use \Dogma\NonIterableMixin;
24: use \Dogma\NonSerializableMixin;
25:
26: /** @var int|string */
27: private $id;
28:
29: /**
30: * @param int|string $id
31: */
32: final private function __construct($id)
33: {
34: Check::types($id, [Type::INT, Type::STRING], 1);
35:
36: $this->id = $id;
37: }
38:
39: /**
40: * @param \Dogma\Entity\Map\IdentityMap $identityMap
41: * @param int|string $id
42: * @return \Dogma\Entity\Identity
43: */
44: final public static function get(IdentityMap $identityMap, $id): self
45: {
46: $className = get_called_class();
47: $identity = $identityMap->findById($className, $id);
48: if ($identity !== null) {
49: return $identity;
50: }
51:
52: $identity = new static($id);
53: $identityMap->add($identity);
54:
55: return $identity;
56: }
57:
58: final public function getId(): int
59: {
60: return $this->id;
61: }
62:
63: }
| 0 % | Entity\Map\CollectionMap.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Map;
11:
12: class CollectionMap
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: ///
17:
18: }
| 0 % | Entity\Map\EntityMap.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Map;
11:
12: use Dogma\Entity\Entity;
13: use Dogma\Entity\Identity;
14:
15: class EntityMap
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var \Dogma\Entity\Entity[][] ($className => ($identityHash => $entity)) */
20: private $entities;
21:
22: public function add(Entity $entity): void
23: {
24: $hash = spl_object_hash($entity->getIdentity());
25: $className = get_class($entity);
26:
27: if (!isset($this->entities[$className][$hash])) {
28: $this->entities[$className][$hash] = $entity;
29: }
30: }
31:
32: public function contains(Identity $identity, string $className): bool
33: {
34: $hash = spl_object_hash($identity);
35:
36: return isset($this->entities[$className][$hash]);
37: }
38:
39: /**
40: * @return \Dogma\Entity\Entity[][]
41: */
42: public function getAll(): array
43: {
44: return $this->entities;
45: }
46:
47: /**
48: * @param string $className
49: * @return \Dogma\Entity\Entity[]
50: */
51: public function getByClass(string $className): array
52: {
53: if (isset($this->entities[$className])) {
54: return $this->entities[$className];
55: } else {
56: return [];
57: }
58: }
59:
60: public function find(Identity $identity, string $className): ?Entity
61: {
62: $hash = spl_object_hash($identity);
63: if (isset($this->entities[$className][$hash])) {
64: return $this->entities[$className][$hash];
65: } else {
66: return null;
67: }
68: }
69:
70: }
| 95 % | Entity\Map\IdentityMap.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Map;
11:
12: use Dogma\Entity\Identity;
13:
14: class IdentityMap
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var \Dogma\Entity\Identity[][] ($className => ($id => $identity)) */
19: protected $idMap = [];
20:
21: public function add(Identity $identity): void
22: {
23: $className = get_class($identity);
24:
25: $this->idMap[$className][$identity->getId()] = $identity;
26: }
27:
28: public function contains(Identity $identity): bool
29: {
30: $className = get_class($identity);
31:
32: return isset($this->idMap[$className][$identity->getId()]);
33: }
34:
35: /**
36: * @return \Dogma\Entity\Identity[]
37: */
38: public function getAll(): array
39: {
40: $identities = [];
41: foreach ($this->idMap as $map) {
42: $identities = array_merge($identities, $map);
43: }
44: return $identities;
45: }
46:
47: /**
48: * @param string $className
49: * @return \Dogma\Entity\Identity[]
50: */
51: public function getByClass(string $className): array
52: {
53: $identities = [];
54: if (isset($this->idMap[$className])) {
55: $identities = array_merge($identities, $this->idMap[$className]);
56: }
57: return $identities;
58: }
59:
60: public function findById(string $className, int $id): ?Identity
61: {
62: if (isset($this->idMap[$className][$id])) {
63: return $this->idMap[$className][$id];
64: } else {
65: return null;
66: }
67: }
68:
69: }
| 0 % | Entity\Map\Versioned\VersionedCollectionMap.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Map\Versioned;
11:
12: class VersionedCollectionMap
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: }
| 0 % | Entity\Map\Versioned\VersionedEntityMap.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Map\Versioned;
11:
12: class VersionedEntityMap extends \Dogma\Entity\Map\EntityMap
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: ///
17:
18: }
| 92 % | Entity\Map\Versioned\VersionedIdentityMap.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Map\Versioned;
11:
12: use Dogma\Check;
13: use Dogma\Entity\Identity;
14:
15: class VersionedIdentityMap extends \Dogma\Entity\Map\IdentityMap implements \Dogma\Transaction\VersionAware
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var \Dogma\Entity\Identity[][] ($versionId => ($id => $identity)) */
20: private $versionMap = [];
21:
22: /** @var int */
23: private $versionId = 0;
24:
25: public function getVersionId(): int
26: {
27: return $this->versionId;
28: }
29:
30: public function incrementVersion(int $versionId): void
31: {
32: Check::range($versionId, $this->versionId + 1);
33:
34: $this->versionId = $versionId;
35: }
36:
37: public function releaseToVersion(int $versionId): void
38: {
39: Check::range($versionId, 0, $this->versionId - 1);
40:
41: // should do a refcount garbage collection, but there is no way to implement it :[
42: // scan all Entities instead? (not completely safe)
43: ///
44: }
45:
46: public function rollbackToVersion(int $versionId): void
47: {
48: Check::range($versionId, 0, $this->versionId - 1);
49:
50: // clean new identities
51: foreach ($this->versionMap as $vid => $items) {
52: if ($vid <= $versionId) {
53: continue;
54: }
55: foreach ($items as $id => $identity) {
56: $className = get_class($identity);
57: unset($this->idMap[$className][$identity->getId()]);
58: }
59: unset($this->versionMap[$vid]);
60: }
61:
62: $this->versionId = $versionId;
63: }
64:
65: public function add(Identity $identity): void
66: {
67: if (!$this->versionId) {
68: throw new \Dogma\Transaction\VersioningNotInitializedException($this);
69: }
70:
71: parent::add($identity);
72:
73: $this->versionMap[$this->versionId][$identity->getId()] = $identity;
74: }
75:
76: }
| 0 % | Entity\Mapping\CollectionHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Mapping;
11:
12: use Dogma\Collection;
13: use Dogma\Mapping\Mapper;
14: use Dogma\Type;
15:
16: /**
17: * Creates a collection containing specified items from raw data and vice versa
18: */
19: class CollectionHandler implements \Dogma\Mapping\Type\Handler
20: {
21: use \Dogma\StrictBehaviorMixin;
22:
23: public function acceptsType(Type $type): bool
24: {
25: return $type->isImplementing(Collection::class);
26: }
27:
28: /**
29: * @param \Dogma\Type $type
30: * @return mixed[]|null
31: */
32: public function getParameters(Type $type): ?array
33: {
34: return null;
35: }
36:
37: /**
38: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
39: * @param \Dogma\Type $type
40: * @param mixed[] $items
41: * @param \Dogma\Mapping\Mapper $mapper
42: * @return \Dogma\Collection
43: */
44: public function createInstance(Type $type, $items, Mapper $mapper): Collection
45: {
46: ///
47:
48: return new Collection($type->getName());
49: }
50:
51: /**
52: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
53: * @param \Dogma\Type $type
54: * @param mixed $instance
55: * @param \Dogma\Mapping\Mapper $mapper
56: * @return mixed[]
57: */
58: public function exportInstance(Type $type, $instance, Mapper $mapper): array
59: {
60: ///
61:
62: return [];
63: }
64:
65: }
| 0 % | Entity\Mapping\EntityHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Mapping;
11:
12: use Dogma\Entity\Entity;
13: use Dogma\Entity\Identity;
14: use Dogma\Entity\Map\EntityMap;
15: use Dogma\Entity\Proxy\EntityProxyFactory;
16: use Dogma\Mapping\Mapper;
17: use Dogma\Reflection\MethodTypeParser;
18: use Dogma\Type;
19:
20: /**
21: * Creates an entity from raw data and vice versa
22: */
23: class EntityHandler extends \Dogma\Mapping\Type\ConstructorHandler implements \Dogma\Mapping\Type\Handler
24: {
25: use \Dogma\StrictBehaviorMixin;
26: use \Dogma\Mapping\Type\ExportableHandlerMixin;
27:
28: /** @var \Dogma\Entity\Map\EntityMap */
29: private $entityMap;
30:
31: /** @var \Dogma\Entity\Proxy\EntityProxyFactory */
32: private $proxyFactory;
33:
34: public function __construct(MethodTypeParser $parser, EntityMap $entityMap, EntityProxyFactory $proxyFactory)
35: {
36: parent::__construct($parser);
37:
38: $this->entityMap = $entityMap;
39: $this->proxyFactory = $proxyFactory;
40: }
41:
42: public function acceptsType(Type $type): bool
43: {
44: return $type->isImplementing(Entity::class);
45: }
46:
47: /**
48: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
49: * @param \Dogma\Type $type
50: * @param mixed[] $data
51: * @param \Dogma\Mapping\Mapper $mapper
52: * @return \Dogma\Entity\Entity
53: */
54: public function createInstance(Type $type, $data, Mapper $mapper): object
55: {
56: if ($data instanceof Identity) {
57: $entity = $this->entityMap->find($data, $type->getName());
58: if ($entity !== null) {
59: return $entity;
60: } else {
61: return $this->proxyFactory->createProxy($data, $type);
62: }
63: } else {
64: /** @var \Dogma\Entity\Entity $entity */
65: $entity = parent::createInstance($type, $data, $mapper);
66: $this->entityMap->add($entity);
67:
68: return $entity;
69: }
70: }
71:
72: }
| 100 % | Entity\Mapping\IdentityHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Mapping;
11:
12: use Dogma\Entity\Identity;
13: use Dogma\Entity\Map\IdentityMap;
14: use Dogma\Mapping\Mapper;
15: use Dogma\Type;
16:
17: /**
18: * Creates identities from raw data and vice versa
19: */
20: class IdentityHandler implements \Dogma\Mapping\Type\Handler
21: {
22: use \Dogma\StrictBehaviorMixin;
23:
24: /** @var \Dogma\Entity\Map\IdentityMap */
25: private $identityMap;
26:
27: public function __construct(IdentityMap $identityMap)
28: {
29: $this->identityMap = $identityMap;
30: }
31:
32: public function acceptsType(Type $type): bool
33: {
34: return $type->isImplementing(Identity::class);
35: }
36:
37: /**
38: * @param \Dogma\Type $type
39: * @return \Dogma\Type[]
40: */
41: public function getParameters(Type $type): array
42: {
43: return [self::SINGLE_PARAMETER => Type::int()];
44: }
45:
46: /**
47: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
48: * @param \Dogma\Type $type
49: * @param int $value
50: * @param \Dogma\Mapping\Mapper $mapper
51: * @return \Dogma\Entity\Identity
52: */
53: public function createInstance(Type $type, $value, Mapper $mapper): Identity
54: {
55: return call_user_func([$type->getName(), 'get'], $this->identityMap, $value);
56: }
57:
58: /**
59: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
60: * @param \Dogma\Type $type
61: * @param \Dogma\Entity\Identity $instance
62: * @param \Dogma\Mapping\Mapper $mapper
63: * @return int
64: */
65: public function exportInstance(Type $type, $instance, Mapper $mapper): int
66: {
67: return $instance->getId();
68: }
69:
70: }
| 0 % | Entity\PartialCollection.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity;
11:
12: class PartialCollection extends \Dogma\Collection
13: {
14:
15: /**
16: * @param string $accepted
17: * @param object[] $items
18: */
19: public function __construct(string $accepted, array $items = [])
20: {
21: parent::__construct($accepted, $items);
22:
23: ///
24: }
25:
26: }
| 0 % | Entity\Proxy\EntityProxy.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Proxy;
11:
12: use Dogma\Entity\Entity;
13: use Dogma\Entity\Identity;
14:
15: /**
16: * Proxy responsibilities:
17: * - lazy reference (empty proxy seeks for entity only when needed)
18: * - immutable decorator (ensures all methods are immutable even when not written to be)
19: * - maybe monade (passes empty value, until a non-proxyfied value is needed)
20: */
21: interface EntityProxy extends \Dogma\Entity\Entity
22: {
23:
24: public function getEntity(): Entity;
25:
26: public function getIdentity(): Identity;
27:
28: }
| 8 % | Entity\Proxy\EntityProxyBuilder.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Proxy;
11:
12: use Dogma\Entity\Entity;
13: use Dogma\Php\PhpGenerator\ClassType as ClassGenerator;
14: use Dogma\Reflection\MethodTypeParser;
15: use Dogma\Type;
16: use Nette\PhpGenerator\Method;
17: use Nette\PhpGenerator\Property;
18:
19: class EntityProxyBuilder
20: {
21: use \Dogma\StrictBehaviorMixin;
22:
23: public const CLASS_NAME_SUFFIX = 'Proxy';
24:
25: /** @var \Dogma\Reflection\MethodTypeParser */
26: private $methodTypeParser;
27:
28: public function __construct(MethodTypeParser $methodTypeParser)
29: {
30: $this->methodTypeParser = $methodTypeParser;
31: }
32:
33: public function registerAutoloader(bool $prepend = false): void
34: {
35: spl_autoload_register([$this, 'autoloadProxy'], true, $prepend);
36: }
37:
38: public function autoloadProxy(string $proxyClass): void
39: {
40: /// temporary solution
41: if (substr($proxyClass, 0, -5) !== self::CLASS_NAME_SUFFIX) {
42: return;
43: }
44: $entityClass = substr($proxyClass, 0, -5);
45: if (!class_exists($entityClass)) {
46: return;
47: }
48: $proxyCode = $this->buildProxy(Type::get($entityClass));
49:
50: eval($proxyCode);
51: }
52:
53: public function buildProxy(Type $type): string
54: {
55: $generator = $this->buildProxyGenerator($type);
56:
57: $nameParts = explode('\\', $type->getName());
58: array_pop($nameParts);
59: $namespace = implode('\\', $nameParts);
60:
61: return $namespace
62: ? 'namespace ' . $namespace . " {\n\n" . (string) $generator . "\n}\n"
63: : (string) $generator;
64: }
65:
66: private function buildProxyGenerator(Type $type): ClassGenerator
67: {
68: if (!$type->isImplementing(Entity::class)) {
69: throw new \Dogma\InvalidTypeException(Entity::class, $type->getName());
70: }
71:
72: $class = new \ReflectionClass($type->getName());
73: if ($class->isFinal() || $class->isAbstract()) {
74: throw new \Dogma\Entity\Proxy\UnsupportedClassTypeException($class->getName(), $class->isFinal() ? 'final' : 'abstract');
75: }
76:
77: $classGenerator = ClassGenerator::from($class);
78:
79: $classGenerator->setName($class->getShortName() . self::CLASS_NAME_SUFFIX);
80: $classGenerator->addExtend($type->getName());
81: $classGenerator->addImplement(EntityProxy::class);
82: $classGenerator->addTrait(EntityProxyMixin::class);
83: $classGenerator->addConst('ENTITY_CLASS', $class->getName());
84:
85: $classGenerator->setProperties([
86: (new Property('identity'))->setVisibility('private'),
87: (new Property('entity'))->setVisibility('private'),
88: (new Property('entityMap'))->setVisibility('private'),
89: ]);
90:
91: $methods = [];
92: foreach ($classGenerator->getMethods() as $methodGenerator) {
93: $method = $class->getMethod($methodGenerator->getName());
94:
95: if ($method->isPrivate() || $method->isConstructor() || $method->isDestructor() || $method->getName() === 'getIdentity') {
96: continue;
97: } elseif ($method->isFinal() || $method->isStatic()) {
98: throw new \Dogma\Entity\Proxy\UnsupportedMethodTypeException($class->getName(), $method->getName(), $method->isFinal() ? 'final' : 'static');
99: }
100:
101: $body = "\$_entity = \$this->getEntity();\n";
102: $parentCall = $this->buildParentCall($methodGenerator);
103: $body .= '$_result = ' . $parentCall . "\n";
104: $body .= 'return $_result;';
105:
106: $methodGenerator->setBody($body);
107:
108: $methods[] = $methodGenerator;
109: }
110: $classGenerator->setMethods($methods);
111:
112: return $classGenerator;
113: }
114:
115: private function buildParentCall(Method $methodGenerator): string
116: {
117: $params = [];
118: foreach ($methodGenerator->getParameters() as $parameterGenerator) {
119: /// todo: not implemented yet
120: //if ($parameterGenerator->isVariadic()) {
121: // $params[] = '...$' . $parameterGenerator->getName();
122: //} else {
123: $params[] = '$' . $parameterGenerator->getName();
124: //}
125: }
126: return $methodGenerator->getName() . '(' . implode(', ', $params) . ');';
127: }
128:
129: }
| 0 % | Entity\Proxy\EntityProxyFactory.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Proxy;
11:
12: use Dogma\Entity\Identity;
13: use Dogma\Entity\Map\EntityMap;
14: use Dogma\Type;
15:
16: class EntityProxyFactory
17: {
18: use \Dogma\StrictBehaviorMixin;
19:
20: /** @var \Dogma\Entity\Map\EntityMap */
21: private $entityMap;
22:
23: public function __construct(EntityMap $entityMap)
24: {
25: $this->entityMap = $entityMap;
26: }
27:
28: public function createProxy(Identity $identity, Type $type): EntityProxy
29: {
30: $proxyClass = $type->getName() . EntityProxyBuilder::CLASS_NAME_SUFFIX;
31:
32: return new $proxyClass($identity, $this->entityMap);
33: }
34:
35: }
| 0 % | Entity\Proxy\EntityProxyMixin.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Proxy;
11:
12: use Dogma\Entity\Entity;
13: use Dogma\Entity\Identity;
14: use Dogma\Entity\Map\EntityMap;
15:
16: trait EntityProxyMixin
17: {
18:
19: final public function __construct(Identity $identity, EntityMap $entityMap)
20: {
21: $this->identity = $identity;
22: $this->entityMap = $entityMap;
23: }
24:
25: public function getIdentity(): Identity
26: {
27: return $this->identity;
28: }
29:
30: public function getEntity(): Entity
31: {
32: if ($this->entity === null) {
33: $this->entity = $this->entityMap->get($this->identity, self::ENTITY_CLASS);
34: }
35: return $this->entity;
36: }
37:
38: }
| 0 % | Entity\Proxy\exceptions\Exception.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Proxy;
11:
12: interface Exception extends \Dogma\Entity\Exception
13: {
14:
15: }
| 0 % | Entity\Proxy\exceptions\UnsupportedClassTypeException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Proxy;
11:
12: class UnsupportedClassTypeException extends \Dogma\Exception implements \Dogma\Entity\Exception
13: {
14:
15: /** @var string */
16: private $className;
17:
18: /** @var string */
19: private $option;
20:
21: /**
22: * @param string $className
23: * @param string $option
24: * @param \Throwable $previous
25: */
26: public function __construct(string $className, string $option, ?\Throwable $previous = null)
27: {
28: parent::__construct(sprintf('Cannot generate proxy for %s class %s.', $option, $className), $previous);
29:
30: $this->className = $className;
31: $this->option = $option;
32: }
33:
34: public function getClassName(): string
35: {
36: return $this->className;
37: }
38:
39: public function getOption(): string
40: {
41: return $this->option;
42: }
43:
44: }
| 0 % | Entity\Proxy\exceptions\UnsupportedMethodTypeException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity\Proxy;
11:
12: class UnsupportedMethodTypeException extends \Dogma\Exception implements \Dogma\Entity\Exception
13: {
14:
15: /** @var string */
16: private $className;
17:
18: /** @var string */
19: private $methodName;
20:
21: /** @var string */
22: private $option;
23:
24: public function __construct(string $className, string $methodName, string $option, ?\Throwable $previous = null)
25: {
26: parent::__construct(sprintf('Cannot generate proxy for %s method %s::%s.', $option, $className, $methodName), $previous);
27:
28: $this->className = $className;
29: $this->methodName = $methodName;
30: $this->option = $option;
31: }
32:
33: public function getClassName(): string
34: {
35: return $this->className;
36: }
37:
38: public function getMethodName(): string
39: {
40: return $this->methodName;
41: }
42:
43: public function getOption(): string
44: {
45: return $this->option;
46: }
47:
48: }
| 0 % | Entity\Repository.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity;
11:
12: use Dogma\Mapping\Mapper;
13: use Dogma\Type;
14:
15: abstract class Repository
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var \Dogma\Type */
20: private $entityType;
21:
22: /** @var \Dogma\Mapping\Mapper */
23: private $mapper;
24:
25: public function __construct(Type $entityType, Mapper $mapper)
26: {
27: if (!$entityType->isImplementing(Entity::class)) {
28: throw new \Dogma\InvalidTypeException(Entity::class, $entityType->getName());
29: }
30: $this->entityType = $entityType;
31: $this->mapper = $mapper;
32: }
33:
34: /**
35: * @param \Dogma\Entity\Identity $identity
36: * @throws \Dogma\Entity\EntityNotFoundException
37: */
38: public function get(Identity $identity): Entity
39: {
40: $entity = $this->find($identity);
41: if (!$entity) {
42: throw new \Dogma\Entity\EntityNotFoundException($identity, $this->entityType->getName());
43: }
44: return $entity;
45: }
46:
47: public function find(Identity $identity): ?Entity
48: {
49: ///
50: $data = [];
51: ///
52:
53: if ($data) {
54: return $this->mapper->map($this->entityType, $data);
55: } else {
56: return null;
57: }
58: }
59:
60: }
| 0 % | Entity\RepositoryContainer.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Entity;
11:
12: use Dogma\Mapping\Mapper;
13: use Dogma\Transaction\TransactionManager;
14: use Dogma\Type;
15:
16: class RepositoryContainer
17: {
18: use \Dogma\StrictBehaviorMixin;
19:
20: /** @var \Dogma\Transaction\TransactionManager */
21: private $transactionManager;
22:
23: /** @var \Dogma\Mapping\Mapper */
24: private $mapper;
25:
26: /** @var \Dogma\Entity\Repository[] */
27: private $repositories;
28:
29: /**
30: * @param \Dogma\Transaction\TransactionManager $transactionManager
31: * @param \Dogma\Mapping\Mapper $mapper
32: * @param \Dogma\Entity\Repository[] $repositories
33: */
34: public function __construct(TransactionManager $transactionManager, Mapper $mapper, array $repositories)
35: {
36: $this->transactionManager = $transactionManager;
37: $this->mapper = $mapper;
38: $this->repositories = $repositories;
39: }
40:
41: /**
42: * @param \Dogma\Transaction\TransactionManager $transactionManager
43: * @param \Dogma\Mapping\Mapper $mapper
44: * @param string[] $classes
45: * @return self
46: */
47: public static function create(TransactionManager $transactionManager, Mapper $mapper, array $classes): self
48: {
49: $repositories = [];
50: foreach ($classes as $entityClass => $repositoryClass) {
51: $repositories[$entityClass] = new $repositoryClass(Type::get($entityClass), $mapper);
52: }
53: return new self($transactionManager, $mapper, $repositories);
54: }
55:
56: public function getRepository(string $entityClass): Repository
57: {
58: if (!isset($this->repositories[$entityClass])) {
59: throw new \Dogma\Entity\RepositoryNotFoundException($entityClass);
60: }
61: return $this->repositories[$entityClass];
62: }
63:
64: public function get(Identity $identity, ?string $entityClass = null): Entity
65: {
66: /// $entityClass = $entityClass ?: $identity->getClass();
67:
68: $repository = $this->getRepository($entityClass);
69:
70: return $repository->get($identity);
71: }
72:
73: public function getById(string $class, int $id): Entity
74: {
75: $identity = Identity::get($class, $id);
76:
77: return $this->get($identity);
78: }
79:
80: }
| 0 % | Enum\Enum.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Enum;
11:
12: interface Enum
13: {
14:
15: /**
16: * @return string|int
17: */
18: public function getValue();
19:
20: }
| 61 % | Enum\EnumMixin.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Enum;
11:
12: use Dogma\Arr;
13:
14: trait EnumMixin
15: {
16: use \Dogma\StrictBehaviorMixin;
17: use \Dogma\NonIterableMixin;
18: use \Dogma\NonCloneableMixin;
19: use \Dogma\NonSerializableMixin;
20:
21: public function __toString(): string
22: {
23: $parts = explode('\\', get_called_class());
24:
25: return sprintf('%s: %s', end($parts), $this->value);
26: }
27:
28: /**
29: * Returns case sensitive regular expression for value validation.
30: * Only the body or expression without modifiers, delimiters and start/end assertions ('^' and '$').
31: */
32: public static function getValueRegexp(): string
33: {
34: return implode('|', self::getAllowedValues());
35: }
36:
37: final public function getConstantName(): string
38: {
39: $class = get_called_class();
40:
41: return Arr::indexOf(self::$availableValues[$class], $this->value);
42: }
43:
44: /**
45: * @param string|int $value
46: */
47: final public function check($value): void
48: {
49: if (!self::isValid($value)) {
50: $class = get_called_class();
51: throw new \Dogma\InvalidValueException($value, $class);
52: }
53: }
54:
55: /**
56: * @param int|string|\Dogma\Enum\Enum $value
57: */
58: final public function equals($value): bool
59: {
60: if (is_scalar($value)) {
61: $value = static::get($value);
62: } elseif (get_class($value) !== static::class) {
63: throw new \Dogma\InvalidTypeException(static::class, $value);
64: }
65:
66: return $this->value === $value->value;
67: }
68:
69: /**
70: * @return static[]
71: */
72: final public static function getInstances(): array
73: {
74: $class = get_called_class();
75: if (empty(self::$availableValues[$class])) {
76: self::init($class);
77: }
78:
79: if (count(self::$availableValues[$class]) !== count(self::$instances[$class])) {
80: foreach (self::$availableValues[$class] as $identifier => $value) {
81: if (!isset(self::$instances[$class][$identifier])) {
82: self::$instances[$class][$identifier] = new static($identifier, self::$availableValues[$class][$identifier]);
83: }
84: }
85: }
86:
87: return self::$instances[$class];
88: }
89:
90: final private static function init(string $class): void
91: {
92: $ref = new \ReflectionClass($class);
93: self::$availableValues[$class] = $ref->getConstants();
94: self::$instances[$class] = [];
95: }
96:
97: }
| 93 % | Enum\IntEnum.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Enum;
11:
12: use Dogma\Arr;
13:
14: abstract class IntEnum implements \Dogma\NonIterable
15: {
16: use \Dogma\Enum\EnumMixin;
17:
18: /** @var \Dogma\Enum\IntEnum[][] ($class => ($value => $enum)) */
19: private static $instances = [];
20:
21: /** @var mixed[][] ($class => ($constName => $value)) */
22: private static $availableValues = [];
23:
24: /** @var int */
25: private $value;
26:
27: final private function __construct(int $value)
28: {
29: $this->value = $value;
30: }
31:
32: /**
33: * @param int $value
34: * @return static
35: */
36: final public static function get(int $value): self
37: {
38: $class = get_called_class();
39: if (empty(self::$availableValues[$class])) {
40: self::init($class);
41: }
42:
43: if (!static::validateValue($value)) {
44: throw new \Dogma\InvalidValueException($value, $class);
45: }
46:
47: if (!Arr::containsKey(self::$instances[$class], $value)) {
48: self::$instances[$class][$value] = new static($value);
49: }
50:
51: return self::$instances[$class][$value];
52: }
53:
54: /**
55: * Validates given value. Can also normalize the value, if needed.
56: *
57: * @param int $value
58: * @return bool
59: */
60: public static function validateValue(int &$value): bool
61: {
62: $class = get_called_class();
63: if (empty(self::$availableValues[$class])) {
64: self::init($class);
65: }
66:
67: return Arr::contains(self::$availableValues[$class], $value);
68: }
69:
70: final public function getValue(): int
71: {
72: return $this->value;
73: }
74:
75: final public static function isValid(int $value): bool
76: {
77: return self::validateValue($value);
78: }
79:
80: /**
81: * @return int[]
82: */
83: final public static function getAllowedValues(): array
84: {
85: $class = get_called_class();
86: if (empty(self::$availableValues[$class])) {
87: self::init($class);
88: }
89:
90: return self::$availableValues[$class];
91: }
92:
93: }
| 0 % | Enum\IntSet.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Enum;
11:
12: use Dogma\Arr;
13:
14: abstract class IntSet
15: {
16: use \Dogma\Enum\SetMixin;
17:
18: /** @var \Dogma\Enum\IntSet[][] ($class => ($value => $enum)) */
19: private static $instances = [];
20:
21: /** @var mixed[][] ($class => ($constName => $value)) */
22: private static $availableValues = [];
23:
24: /** @var int */
25: private $value;
26:
27: /** @var int[] */
28: private $values = [];
29:
30: /**
31: * @param int $value
32: * @param int[] $values
33: */
34: final private function __construct(string $value, array $values)
35: {
36: $this->value = $value;
37: $this->values = $values;
38: }
39:
40: /**
41: * @param int ...$values
42: * @return static
43: */
44: final public static function get(int ...$values): self
45: {
46: $class = get_called_class();
47: if (empty(self::$availableValues[$class])) {
48: self::init($class);
49: }
50: $value = 0;
51: foreach ($values as $val) {
52: $value |= $val;
53: }
54: $values = [];
55: $n = 0;
56: $val = 1;
57: while ($n++ < 62) {
58: $found = $value & $val;
59: if ($found) {
60: if (!static::validateValue($val)) {
61: throw new \Dogma\InvalidValueException($val, $class);
62: }
63: $values[] = $val;
64: }
65: $val = $val << 1;
66: }
67:
68: if (!isset(self::$instances[$class][$value])) {
69: self::$instances[$class][$value] = new static($value, $values);
70: }
71:
72: return self::$instances[$class][$value];
73: }
74:
75: /**
76: * Validates given value. Can also normalize the value, if needed.
77: *
78: * @param int $value
79: * @return bool
80: */
81: public static function validateValue(int &$value): bool
82: {
83: $class = get_called_class();
84: if (empty(self::$availableValues[$class])) {
85: self::init($class);
86: }
87:
88: return Arr::contains(self::$availableValues[$class], $value);
89: }
90:
91: final public function getValue(): int
92: {
93: return $this->value;
94: }
95:
96: /**
97: * @return int[]
98: */
99: final public function getValues(): array
100: {
101: return $this->values;
102: }
103:
104: final public static function isValid(string $value): bool
105: {
106: return self::validateValue($value);
107: }
108:
109: /**
110: * @return int[]
111: */
112: final public static function getAllowedValues(): array
113: {
114: $class = get_called_class();
115: if (empty(self::$availableValues[$class])) {
116: self::init($class);
117: }
118:
119: return self::$availableValues[$class];
120: }
121:
122: /**
123: * @param int ...$addValues
124: * @return static
125: */
126: public function add(int ...$addValues): self
127: {
128: $values = $this->getValues();
129: foreach ($addValues as $val) {
130: self::check($val);
131:
132: if (!in_array($val, $values)) {
133: $values[] = $val;
134: }
135: }
136:
137: return static::get(...$values);
138: }
139:
140: /**
141: * @param int ...$removeValues
142: * @return static
143: */
144: public function remove(int ...$removeValues): self
145: {
146: $values = $this->getValues();
147: foreach ($removeValues as $val) {
148: self::check($val);
149:
150: $key = array_search($val, $values);
151: unset($values[$key]);
152: }
153:
154: return static::get(...$values);
155: }
156:
157: /**
158: * @param int ...$containsValues
159: * @return bool
160: */
161: public function contains(int ...$containsValues): bool
162: {
163: foreach ($containsValues as $val) {
164: self::check($val);
165:
166: if (!in_array($val, $this->values)) {
167: return false;
168: }
169: }
170:
171: return true;
172: }
173:
174: /**
175: * @param int ...$containsValues
176: * @return bool
177: */
178: public function containsAny(int ...$containsValues): bool
179: {
180: foreach ($containsValues as $val) {
181: self::check($val);
182:
183: if (in_array($val, $this->values)) {
184: return true;
185: }
186: }
187:
188: return false;
189: }
190:
191: }
| 0 % | Enum\PartialIntEnum.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Enum;
11:
12: use Dogma\Arr;
13:
14: abstract class PartialIntEnum extends \Dogma\Enum\IntEnum
15: {
16:
17: public static function isKnownValue(int $value): bool
18: {
19: return Arr::contains(static::getAllowedValues(), $value);
20: }
21:
22: public static function validateValue(int &$value): bool
23: {
24: $regexp = '/^' . static::getValueRegexp() . '?$/';
25: $result = preg_match($regexp, $value);
26: if ($result === false) {
27: throw new \Dogma\InvalidRegularExpressionException($regexp);
28: }
29: return (bool) $result;
30: }
31:
32: public static function getValueRegexp(): string
33: {
34: throw new \LogicException(sprintf('Validation rule cannot be created automatically for class %s. Reimplement the validateValue() or getValueRegexp() method.', get_called_class()));
35: }
36:
37: }
| 0 % | Enum\PartialStringEnum.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Enum;
11:
12: use Dogma\Arr;
13:
14: abstract class PartialStringEnum extends \Dogma\Enum\StringEnum
15: {
16:
17: public static function isKnownValue(string $value): bool
18: {
19: return Arr::contains(static::getAllowedValues(), $value);
20: }
21:
22: public static function validateValue(string &$value): bool
23: {
24: $regexp = '/^' . static::getValueRegexp() . '?$/';
25: $result = preg_match($regexp, $value);
26: if ($result === false) {
27: throw new \Dogma\InvalidRegularExpressionException($regexp);
28: }
29: return (bool) $result;
30: }
31:
32: public static function getValueRegexp(): string
33: {
34: throw new \LogicException(sprintf('Validation rule cannot be created automatically for class %s. Reimplement the validateValue() or getValueRegexp() method.', get_called_class()));
35: }
36:
37: }
| 0 % | Enum\SetMixin.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Enum;
11:
12: use Dogma\Arr;
13:
14: trait SetMixin
15: {
16: use \Dogma\StrictBehaviorMixin;
17: use \Dogma\NonIterableMixin;
18: use \Dogma\NonCloneableMixin;
19: use \Dogma\NonSerializableMixin;
20:
21: public function __toString(): string
22: {
23: $classNameParts = explode('\\', get_called_class());
24:
25: return sprintf('%s: %s', end($classNameParts), implode(',', $this->values));
26: }
27:
28: /**
29: * Returns case sensitive regular expression for value validation.
30: * Only the body or expression without modifiers, delimiters and start/end assertions ('^' and '$').
31: */
32: public static function getValueRegexp(): string
33: {
34: return implode('|', self::getAllowedValues());
35: }
36:
37: /**
38: * @return string[]|int[]
39: */
40: final public function getConstantNames(): array
41: {
42: $class = get_called_class();
43: $names = [];
44: foreach ($this->getValues() as $value) {
45: $names[] = Arr::indexOf(self::$availableValues[$class], $value);
46: }
47:
48: return $names;
49: }
50:
51: /**
52: * @param string|int $value
53: */
54: final public function check($value): void
55: {
56: if (!self::isValid($value)) {
57: $class = get_called_class();
58: throw new \Dogma\InvalidValueException($value, $class);
59: }
60: }
61:
62: /**
63: * @param int|string|\Dogma\Enum\Enum $value
64: */
65: final public function equals($value): bool
66: {
67: if (is_scalar($value)) {
68: $value = static::get($value);
69: } elseif (get_class($value) !== static::class) {
70: throw new \Dogma\InvalidTypeException(static::class, $value);
71: }
72:
73: return $this->value === $value->value;
74: }
75:
76: /**
77: * @return static[]
78: */
79: final public static function getInstances(): array
80: {
81: $class = get_called_class();
82: if (empty(self::$availableValues[$class])) {
83: self::init($class);
84: }
85:
86: if (count(self::$availableValues[$class]) !== count(self::$instances[$class])) {
87: foreach (self::$availableValues[$class] as $identifier => $value) {
88: if (!isset(self::$instances[$class][$identifier])) {
89: self::$instances[$class][$identifier] = new static($identifier, self::$availableValues[$class][$identifier]);
90: }
91: }
92: }
93:
94: return self::$instances[$class];
95: }
96:
97: final private static function init(string $class): void
98: {
99: $ref = new \ReflectionClass($class);
100: self::$availableValues[$class] = $ref->getConstants();
101: self::$instances[$class] = [];
102: }
103:
104: }
| 77 % | Enum\StringEnum.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Enum;
11:
12: use Dogma\Arr;
13:
14: abstract class StringEnum implements \Dogma\NonIterable
15: {
16: use \Dogma\Enum\EnumMixin;
17:
18: /** @var \Dogma\Enum\StringEnum[][] ($class => ($value => $enum)) */
19: private static $instances = [];
20:
21: /** @var mixed[][] ($class => ($constName => $value)) */
22: private static $availableValues = [];
23:
24: /** @var string */
25: private $value;
26:
27: final private function __construct(string $value)
28: {
29: $this->value = $value;
30: }
31:
32: /**
33: * @param string $value
34: * @return static
35: */
36: final public static function get(string $value): self
37: {
38: $class = get_called_class();
39: if (empty(self::$availableValues[$class])) {
40: self::init($class);
41: }
42:
43: if (!static::validateValue($value)) {
44: throw new \Dogma\InvalidValueException($value, $class);
45: }
46:
47: if (!Arr::containsKey(self::$instances[$class], $value)) {
48: self::$instances[$class][$value] = new static($value);
49: }
50:
51: return self::$instances[$class][$value];
52: }
53:
54: /**
55: * Validates given value. Can also normalize the value, if needed.
56: *
57: * @param string $value
58: * @return bool
59: */
60: public static function validateValue(string &$value): bool
61: {
62: $class = get_called_class();
63: if (empty(self::$availableValues[$class])) {
64: self::init($class);
65: }
66:
67: return Arr::contains(self::$availableValues[$class], $value);
68: }
69:
70: final public function getValue(): string
71: {
72: return $this->value;
73: }
74:
75: final public static function isValid(string $value): bool
76: {
77: return self::validateValue($value);
78: }
79:
80: /**
81: * @return string[]
82: */
83: final public static function getAllowedValues(): array
84: {
85: $class = get_called_class();
86: if (empty(self::$availableValues[$class])) {
87: self::init($class);
88: }
89:
90: return self::$availableValues[$class];
91: }
92:
93: }
| 0 % | Enum\StringSet.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Enum;
11:
12: use Dogma\Arr;
13:
14: abstract class StringSet
15: {
16: use \Dogma\Enum\SetMixin;
17:
18: /** @var \Dogma\Enum\StringSet[][] ($class => ($value => $enum)) */
19: private static $instances = [];
20:
21: /** @var mixed[][] ($class => ($constName => $value)) */
22: private static $availableValues = [];
23:
24: /** @var string */
25: private $value;
26:
27: /** @var string[] */
28: private $values = [];
29:
30: /**
31: * @param string $value
32: * @param string[] $values
33: */
34: final private function __construct(string $value, array $values)
35: {
36: $this->value = $value;
37: $this->values = $values;
38: }
39:
40: /**
41: * @param string ...$values
42: * @return static
43: */
44: final public static function get(string ...$values): self
45: {
46: $class = get_called_class();
47: if (empty(self::$availableValues[$class])) {
48: self::init($class);
49: }
50:
51: sort($values);
52: foreach ($values as $val) {
53: if (static::validateValue($val)) {
54: throw new \Dogma\InvalidValueException($val, $class);
55: }
56: }
57: $value = implode(',', $values);
58: if (!Arr::containsKey(self::$instances[$class], $value)) {
59: self::$instances[$class][$value] = new static($value, $values);
60: }
61:
62: return self::$instances[$class][$value];
63: }
64:
65: /**
66: * Validates given value. Can also normalize the value, if needed.
67: *
68: * @param string $value
69: * @return bool
70: */
71: public static function validateValue(string &$value): bool
72: {
73: $class = get_called_class();
74: if (empty(self::$availableValues[$class])) {
75: self::init($class);
76: }
77:
78: return Arr::contains(self::$availableValues[$class], $value);
79: }
80:
81: final public function getValue(): string
82: {
83: return $this->value;
84: }
85:
86: /**
87: * @return string[]
88: */
89: final public function getValues(): array
90: {
91: return $this->values;
92: }
93:
94: final public static function isValid(string $value): bool
95: {
96: return self::validateValue($value);
97: }
98:
99: /**
100: * @return string[]
101: */
102: final public static function getAllowedValues(): array
103: {
104: $class = get_called_class();
105: if (empty(self::$availableValues[$class])) {
106: self::init($class);
107: }
108:
109: return self::$availableValues[$class];
110: }
111:
112: /**
113: * @param string ...$addValues
114: * @return static
115: */
116: public function add(string ...$addValues): self
117: {
118: $values = $this->getValues();
119: foreach ($addValues as $val) {
120: self::check($val);
121:
122: if (!in_array($val, $values)) {
123: $values[] = $val;
124: }
125: }
126:
127: return static::get(...$values);
128: }
129:
130: /**
131: * @param string ...$removeValues
132: * @return static
133: */
134: public function remove(string ...$removeValues): self
135: {
136: $values = $this->getValues();
137: foreach ($removeValues as $val) {
138: self::check($val);
139:
140: $key = array_search($val, $values);
141: unset($values[$key]);
142: }
143:
144: return static::get(...$values);
145: }
146:
147: /**
148: * @param string ...$containsValues
149: * @return bool
150: */
151: public function contains(string ...$containsValues): bool
152: {
153: foreach ($containsValues as $val) {
154: self::check($val);
155:
156: if (!in_array($val, $this->values)) {
157: return false;
158: }
159: }
160:
161: return true;
162: }
163:
164: /**
165: * @param string ...$containsValues
166: * @return bool
167: */
168: public function containsAny(string ...$containsValues): bool
169: {
170: foreach ($containsValues as $val) {
171: self::check($val);
172:
173: if (in_array($val, $this->values)) {
174: return true;
175: }
176: }
177:
178: return false;
179: }
180:
181: }
| 41 % | Geolocation\Position.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Geolocation;
11:
12: use Dogma\Check;
13: use Dogma\Math\Vector\Vector3;
14:
15: /**
16: * http://www.movable-type.co.uk/scripts/latlong.html
17: */
18: class Position implements \Dogma\NonIterable, \Dogma\Mapping\Type\Exportable
19: {
20: use \Dogma\StrictBehaviorMixin;
21: use \Dogma\NonIterableMixin;
22:
23: public const PLANET_EARTH_RADIUS = 6371000.0;
24:
25: /** @var float [m] */
26: private $planetRadius;
27:
28: /** @var float [degrees] */
29: private $latitude;
30:
31: /** @var float [degrees] */
32: private $longitude;
33:
34: /** @var float[] */
35: private $normalVector;
36:
37: public function __construct(float $latitude, float $longitude, float $planetRadius = self::PLANET_EARTH_RADIUS)
38: {
39: Check::range($latitude, -90.0, 90.0);
40: Check::range($longitude, -180.0, 180.0);
41: Check::nullableFloat($planetRadius, 0.0);
42:
43: $this->latitude = $latitude;
44: $this->longitude = $longitude;
45: $this->planetRadius = $planetRadius;
46: }
47:
48: public static function fromRadians(float $latRad, float $lonRad, ?float $planetRadius = null): self
49: {
50: Check::range($latRad, -M_PI_2, M_PI_2);
51: Check::range($lonRad, -M_PI, M_PI);
52:
53: $position = new static(rad2deg($latRad), rad2deg($lonRad), $planetRadius);
54:
55: return $position;
56: }
57:
58: public static function fromNormalVector(float $x, float $y, float $z, ?float $planetRadius = null): self
59: {
60: Check::range($x, 0.0, 1.0);
61: Check::range($y, 0.0, 1.0);
62: Check::range($z, 0.0, 1.0);
63:
64: list($latRad, $lonRad) = Vector3::normalVectorToRadians($x, $y, $z);
65:
66: $position = new static(rad2deg($latRad), rad2deg($lonRad), $planetRadius);
67: $position->normalVector = [$x, $y, $z];
68:
69: return $position;
70: }
71:
72: /**
73: * @return float[] array('latitude' => $latitude, 'longitude' => $longitude)
74: */
75: public function export(): array
76: {
77: return [
78: 'latitude' => $this->latitude,
79: 'longitude' => $this->longitude,
80: ];
81: }
82:
83: public function getLatitude(): float
84: {
85: return $this->latitude;
86: }
87:
88: public function getLongitude(): float
89: {
90: return $this->longitude;
91: }
92:
93: public function getPlanetRadius(): float
94: {
95: return $this->planetRadius;
96: }
97:
98: /**
99: * @return float[]
100: */
101: public function getNormalVector(): array
102: {
103: if ($this->normalVector === null) {
104: $this->normalVector = Vector3::radiansToNormalVector(deg2rad($this->latitude), deg2rad($this->longitude));
105: }
106: return $this->normalVector;
107: }
108:
109: }
| 75 % | Geolocation\PositionFormatter.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Geolocation;
11:
12: use Dogma\Math\Angle\AngleFormatter;
13:
14: class PositionFormatter
15: {
16: use \Dogma\StaticClassMixin;
17:
18: public const LATITUDE = 'l';
19: public const LATITUDE_SIGNED = 'L';
20: public const LATITUDE_NORTH_SOUTH = 'N';
21: public const LATITUDE_NS = 'n';
22:
23: public const LONGITUDE = 'o';
24: public const LONGITUDE_SIGNED = 'O';
25: public const LONGITUDE_EAST_WEST = 'E';
26: public const LONGITUDE_EW = 'e';
27:
28: // reserved
29: private const ALTITUDE = 'a';
30: private const ALTITUDE_SIGNED = 'A';
31: private const ALTITUDE_ABOVE_BELOW = 'B';
32: private const ALTITUDE_AB = 'b';
33:
34: public const FORMAT_PRETTY = 'nl,eo';
35: public const FORMAT_DEFAULT = 'L,O';
36:
37: /** @var string[] */
38: private static $specialCharacters = [
39: self::LATITUDE,
40: self::LATITUDE_SIGNED,
41: self::LATITUDE_NORTH_SOUTH,
42: self::LATITUDE_NS,
43: self::LONGITUDE,
44: self::LONGITUDE_SIGNED,
45: self::LONGITUDE_EAST_WEST,
46: self::LONGITUDE_EW,
47: self::ALTITUDE,
48: self::ALTITUDE_SIGNED,
49: self::ALTITUDE_ABOVE_BELOW,
50: self::ALTITUDE_AB,
51: ];
52:
53: /** @var \Dogma\Math\Angle\AngleFormatter */
54: private $angleFormatter;
55:
56: /** @var string */
57: private $format;
58:
59: public function __construct(string $format = self::FORMAT_DEFAULT, ?AngleFormatter $angleFormatter = null)
60: {
61: $this->angleFormatter = $angleFormatter ?? new AngleFormatter(AngleFormatter::FORMAT_NUMBER);
62: $this->format = $format;
63: }
64:
65: public function format(
66: Position $position,
67: string $format = self::FORMAT_DEFAULT,
68: ?string $angleFormatter = null
69: ): string
70: {
71: $angleFormatter = $angleFormatter ?? $this->angleFormatter;
72:
73: $result = '';
74: $escaped = false;
75: foreach (str_split($format) as $character) {
76: if ($character === '%' && !$escaped) {
77: $escaped = true;
78: } elseif ($escaped === false && in_array($character, self::$specialCharacters)) {
79: switch ($character) {
80: case self::LATITUDE:
81: $result .= $angleFormatter->format(abs($position->getLatitude()));
82: break;
83: case self::LATITUDE_SIGNED:
84: $result .= $angleFormatter->format($position->getLatitude());
85: break;
86: case self::LATITUDE_NORTH_SOUTH:
87: $result .= $position->getLatitude() < 0.0 ? 'south' : 'north';
88: break;
89: case self::LATITUDE_NS:
90: $result .= $position->getLatitude() < 0.0 ? 'S' : 'N';
91: break;
92: case self::LONGITUDE:
93: $result .= $angleFormatter->format(abs($position->getLongitude()));
94: break;
95: case self::LONGITUDE_SIGNED:
96: $result .= $angleFormatter->format($position->getLongitude());
97: break;
98: case self::LONGITUDE_EAST_WEST:
99: $result .= $position->getLongitude() < 0.0 ? 'west' : 'east';
100: break;
101: case self::LONGITUDE_EW:
102: $result .= $position->getLongitude() < 0.0 ? 'W' : 'E';
103: break;
104: case self::ALTITUDE:
105: $result .= '0';
106: break;
107: case self::ALTITUDE_SIGNED:
108: $result .= '0';
109: break;
110: case self::ALTITUDE_ABOVE_BELOW:
111: $result .= 'above';
112: break;
113: case self::ALTITUDE_AB:
114: $result .= 'A';
115: break;
116: }
117: $escaped = false;
118: } else {
119: $result .= $character;
120: }
121: }
122:
123: return $result;
124: }
125:
126: }
| 0 % | Http\Channel\Channel.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http\Channel;
11:
12: use Dogma\Http\Curl\CurlHelper;
13: use Dogma\Http\Request;
14: use Dogma\Http\Response;
15:
16: /**
17: * HTTP channel for multiple similar requests.
18: */
19: class Channel
20: {
21: use \Dogma\StrictBehaviorMixin;
22:
23: /** @var \Dogma\Http\Channel\ChannelManager */
24: private $manager;
25:
26: /** @var \Dogma\Http\Request */
27: private $requestPrototype;
28:
29: /** @var int */
30: private $priority = 1;
31:
32: /** @var int */
33: private $threadLimit = 10;
34:
35: /** @var int */
36: private $lastIndex = 0;
37:
38: /** @var bool */
39: private $initiated = false;
40:
41: /** @var bool */
42: private $stopped = false;
43:
44: /** @var int|bool */
45: private $paused = false;
46:
47: /** @var string[]|string[][] (int|string $name => $data) */
48: private $queue = [];
49:
50: /** @var string[]|string[][] (int|string $name => $data) */
51: private $running = [];
52:
53: /** @var \Dogma\Http\Response[] */
54: private $finished = [];
55:
56: /** @var mixed[] (int|string $name => $context) */
57: private $contexts = [];
58:
59: /** @var callable */
60: private $responseHandler;
61:
62: /** @var callable */
63: private $redirectHandler;
64:
65: /** @var callable */
66: private $errorHandler;
67:
68: public function __construct(Request $requestPrototype, ?ChannelManager $manager = null)
69: {
70: $this->requestPrototype = $requestPrototype;
71:
72: if ($manager === null) {
73: $manager = new ChannelManager();
74: $manager->addChannel($this);
75: }
76: $this->manager = $manager;
77:
78: if ($requestPrototype->getHeaderParser() === null) {
79: $requestPrototype->setHeaderParser($manager->getHeaderParser());
80: }
81: }
82:
83: public function getRequestPrototype(): Request
84: {
85: return $this->requestPrototype;
86: }
87:
88: /**
89: * Set callback handler for every response (even an error)
90: * @param callable $responseHandler (\Dogma\Http\Response $response, \Dogma\Http\Channel $channel, string $name)
91: */
92: public function setResponseHandler(callable $responseHandler): void
93: {
94: $this->responseHandler = $responseHandler;
95: }
96:
97: /**
98: * Set separate callback handler for redirects. ResponseHandler will no longer handle these.
99: * @param callable $redirectHandler (\Dogma\Http\Response $response, \Dogma\Http\Channel $channel, string $name)
100: */
101: public function setRedirectHandler(callable $redirectHandler): void
102: {
103: $this->redirectHandler = $redirectHandler;
104: }
105:
106: /**
107: * Set separate callback handler for errors. ResponseHandler will no longer handle these.
108: * @param callable $errorHandler (\Dogma\Http\Response $response, \Dogma\Http\Channel $channel, string $name)
109: */
110: public function setErrorHandler(callable $errorHandler): void
111: {
112: $this->errorHandler = $errorHandler;
113: }
114:
115: public function setPriority(int $priority): void
116: {
117: $this->priority = abs($priority);
118: }
119:
120: public function getPriority(): int
121: {
122: return $this->priority;
123: }
124:
125: public function setThreadLimit(int $threads): void
126: {
127: $this->threadLimit = abs($threads);
128: }
129:
130: public function getThreadLimit(): int
131: {
132: return $this->threadLimit;
133: }
134:
135: // jobs ------------------------------------------------------------------------------------------------------------
136:
137: /**
138: * Run a new job immediately and wait for the response.
139: * @param string|string[] $data
140: * @param mixed $context
141: * @return \Dogma\Http\Response|null
142: */
143: public function fetchJob($data, $context = null): ?Response
144: {
145: $name = $this->addJob($data, $context, null, true);
146:
147: return $this->fetch($name);
148: }
149:
150: /**
151: * Run a new job immediately. Don't wait for response.
152: * @param string|string[] $data
153: * @param mixed $context
154: * @param string|int $name
155: * @return string|int
156: */
157: public function runJob($data, $context = null, $name = null)
158: {
159: return $this->addJob($data, $context, $name, true);
160: }
161:
162: /**
163: * Add new job to channel queue.
164: * @param string|string[] $data
165: * @param mixed $context
166: * @param string|int $name
167: * @param bool $forceStart
168: * @return string|int
169: */
170: public function addJob($data, $context = null, $name = null, bool $forceStart = false)
171: {
172: if (!is_string($data) && !is_array($data)) {
173: throw new \Dogma\Http\Channel\ChannelException('Illegal job data. Job data can be either string or array.');
174: }
175:
176: if (is_string($name) || is_int($name)) {
177: $this->queue[$name] = $data;
178:
179: } elseif ($name === null) {
180: $name = ++$this->lastIndex;
181: $this->queue[$name] = $data;
182:
183: } else {
184: throw new \Dogma\Http\Channel\ChannelException('Illegal job name. Job name can be only a string or an integer.');
185: }
186:
187: if (isset($context)) {
188: $this->contexts[$name] = $context;
189: }
190:
191: if ($forceStart) {
192: $this->startJob($name);
193: } else {
194: $this->manager->startJobs();
195: }
196:
197: return $name;
198: }
199:
200: /**
201: * Add more jobs to a channel. Array indexes are job names if they are strings.
202: * @param string[]|string[][] $jobs
203: * @param mixed $context
204: */
205: public function addJobs(array $jobs, $context = null): void
206: {
207: $useKeys = array_keys($jobs) !== range(0, count($jobs) - 1);
208:
209: foreach ($jobs as $name => $data) {
210: $this->addJob($data, $context, $useKeys ? $name : null);
211: }
212: }
213:
214: public function getRunningJobCount(): int
215: {
216: return count($this->running);
217: }
218:
219: /**
220: * Decide if channel can start a job.
221: */
222: public function canStartJob(): bool
223: {
224: if (empty($this->queue)) {
225: return false;
226: }
227: if ($this->stopped) {
228: return false;
229: }
230: if ($this->isPaused()) {
231: return false;
232: }
233: if (!empty($this->running) && count($this->running) >= $this->threadLimit) {
234: return false;
235: }
236:
237: return true;
238: }
239:
240: /**
241: * Start a request in CURL. Called by ChannelManager
242: * @internal
243: *
244: * @param string|int|null $name
245: */
246: public function startJob($name = null): void
247: {
248: if (!$this->canStartJob()) {
249: return;
250: }
251:
252: if ($name === null) {
253: $name = array_keys($this->queue);
254: $name = $name[0];
255: }
256:
257: if (!$this->initiated) {
258: $this->requestPrototype->init();
259: $this->initiated = true;
260: }
261:
262: $request = clone $this->requestPrototype;
263: $request->setData($this->queue[$name]);
264:
265: if (!empty($this->contexts[$name])) {
266: $request->setContext($this->contexts[$name]);
267: unset($this->contexts[$name]);
268: }
269:
270: $request->prepare();
271: $handler = $request->getHandler();
272: $error = curl_multi_add_handle($this->manager->getHandler(), $handler);
273: if ($error !== 0) {
274: throw new \Dogma\Http\Channel\ChannelException(sprintf('CURL error when adding a job: %s', CurlHelper::getCurlMultiErrorName($error)), $error);
275: }
276:
277: $this->running[$name] = $this->queue[$name];
278: unset($this->queue[$name]);
279: $this->manager->jobStarted($handler, $this, $name, $request);
280: }
281:
282: // -----------------------------------------------------------------------------------------------------------------
283:
284: /**
285: * Called by ChannelManager.
286: * @internal
287: *
288: * @param string|int|int $name
289: * @param mixed[] $multiInfo
290: * @param \Dogma\Http\Request $request
291: */
292: public function jobFinished($name, array $multiInfo, Request $request): void
293: {
294: unset($this->running[$name]);
295: $data = curl_multi_getcontent($multiInfo['handle']);
296:
297: $response = $request->createResponse($data, $multiInfo['result']);
298: $this->finished[$name] = $response;
299:
300: if ($this->errorHandler && $response->getStatus()->isError()) {
301: ($this->errorHandler)($response, $this, $name);
302: unset($this->finished[$name]);
303:
304: } elseif ($this->redirectHandler && $response->getStatus()->isRedirect()) {
305: ($this->redirectHandler)($response, $this, $name);
306: unset($this->finished[$name]);
307:
308: } elseif ($this->responseHandler) {
309: ($this->responseHandler)($response, $this, $name);
310: unset($this->finished[$name]);
311: }
312: }
313:
314: /**
315: * @param string|int|null $name
316: * @return \Dogma\Http\Response|null
317: */
318: public function fetch($name = null): ?Response
319: {
320: if ($name !== null) {
321: return $this->fetchByName($name);
322: }
323:
324: if (!empty($this->finished)) {
325: return array_shift($this->finished);
326: }
327:
328: // start one job immediately
329: if (empty($this->running)) {
330: if (empty($this->queue)) {
331: return null;
332: }
333:
334: $this->startJob();
335: $this->manager->read();
336: }
337:
338: // potentially endless loop, if something goes wrong (always set request timeouts!)
339: /// add timeout or retries
340: while (empty($this->finished)) {
341: $this->manager->read();
342: }
343:
344: return array_shift($this->finished);
345: }
346:
347: /**
348: * @param string|int $name
349: * @return \Dogma\Http\Response|null
350: */
351: private function fetchByName($name): ?Response
352: {
353: if (!isset($this->queue[$name]) && !isset($this->running[$name]) && !isset($this->finished[$name])) {
354: throw new \Dogma\Http\Channel\ChannelException(sprintf('Job named \'%s\' was not found.', $name));
355: }
356:
357: if (isset($this->finished[$name])) {
358: $response = $this->finished[$name];
359: unset($this->finished[$name]);
360: return $response;
361: }
362:
363: // start job immediately
364: if (isset($this->queue[$name])) {
365: $this->startJob($name);
366: $this->manager->read();
367: }
368:
369: // potentially endless loop, if something goes wrong (always set request timeouts!)
370: /// add timeout or retries
371: while (!isset($this->finished[$name])) {
372: $this->manager->read();
373: }
374:
375: $response = $this->finished[$name];
376: unset($this->finished[$name]);
377: return $response;
378: }
379:
380: /**
381: * Check if channel or a job is finished.
382: * @param string|int|null $name
383: * @return bool
384: */
385: public function isFinished($name = null): bool
386: {
387: if ($name === null) {
388: return empty($this->running) && empty($this->queue);
389: } else {
390: return isset($this->finished[$name]);
391: }
392: }
393:
394: /**
395: * Wait till all jobs are finished.
396: */
397: public function finish(): void
398: {
399: while (!$this->isFinished()) {
400: $this->manager->read();
401: }
402: }
403:
404: public function stop(): void
405: {
406: $this->stopped = true;
407: }
408:
409: public function isStopped(): bool
410: {
411: return $this->stopped;
412: }
413:
414: public function pause(int $seconds = 0): void
415: {
416: if ($seconds) {
417: $this->paused = time() + $seconds;
418: } else {
419: $this->paused = true;
420: }
421: }
422:
423: public function isPaused(): bool
424: {
425: if (is_int($this->paused) && $this->paused <= time()) {
426: $this->paused = false;
427: }
428: return $this->paused;
429: }
430:
431: public function resume(): void
432: {
433: $this->stopped = false;
434: $this->paused = false;
435: }
436:
437: public function read(): void
438: {
439: $this->manager->read();
440: }
441:
442: }
| 0 % | Http\Channel\ChannelManager.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http\Channel;
11:
12: use Dogma\Http\Curl\CurlHelper;
13: use Dogma\Http\HeaderParser;
14: use Dogma\Http\Request;
15: use Dogma\Time\Provider\CurrentTimeProvider;
16:
17: /**
18: * Manages parallel requests over multiple HTTP channels.
19: */
20: class ChannelManager
21: {
22: use \Dogma\StrictBehaviorMixin;
23: use \Dogma\NonSerializableMixin;
24: use \Dogma\NonCloneableMixin;
25:
26: /** @var resource (curl) */
27: private $handler;
28:
29: /** @var int maximum threads for all channels */
30: private $threadLimit = 20;
31:
32: /** @var float sum of priorities of all channels */
33: private $sumPriorities = 0.0;
34:
35: /** @var \Dogma\Http\Channel\Channel[] */
36: private $channels = [];
37:
38: /** @var mixed[] ($resourceId => array($channelId, $jobName, $request)) */
39: private $resources = [];
40:
41: /** @var \Dogma\Http\HeaderParser */
42: private $headerParser;
43:
44: public function __construct(?HeaderParser $headerParser = null)
45: {
46: $this->headerParser = $headerParser;
47: $this->handler = curl_multi_init();
48: if (!$this->handler) {
49: throw new \Dogma\Http\Channel\ChannelException('Cannot initialize CURL multi-request.');
50: }
51: }
52:
53: public function __destruct()
54: {
55: if ($this->handler) {
56: curl_multi_close($this->handler);
57: }
58: }
59:
60: /**
61: * @return resource
62: */
63: public function getHandler()
64: {
65: return $this->handler;
66: }
67:
68: /**
69: * Set maximum of request to run in parallel.
70: * @param int $threads
71: */
72: public function setThreadLimit(int $threads): void
73: {
74: $this->threadLimit = abs($threads);
75: }
76:
77: public function addChannel(Channel $channel): void
78: {
79: $this->channels[spl_object_hash($channel)] = $channel;
80: $this->updatePriorities();
81: $this->startJobs();
82: }
83:
84: private function updatePriorities(): void
85: {
86: $sum = 0;
87: foreach ($this->channels as $channel) {
88: $sum += $channel->getPriority();
89: }
90: $this->sumPriorities = $sum;
91: }
92:
93: public function read(): void
94: {
95: $this->waitForResult();
96: $this->readResults();
97: }
98:
99: /**
100: * Wait for any request to finish. Blocking. Returns count of available results.
101: */
102: private function waitForResult(): int
103: {
104: $run = false;
105: foreach ($this->channels as $channel) {
106: if (!$channel->isFinished()) {
107: $run = true;
108: }
109: }
110: if (!$run) {
111: return 0;
112: }
113:
114: do {
115: $active = $this->exec();
116: $ready = curl_multi_select($this->handler);
117:
118: if ($ready > 0) {
119: return $ready;
120: }
121:
122: } while ($active > 0 && $ready !== -1);
123:
124: return 0;
125: }
126:
127: public function exec(): int
128: {
129: do {
130: $error = curl_multi_exec($this->handler, $active);
131: if ($error > 0) {
132: throw new \Dogma\Http\Channel\ChannelException('CURL error when starting jobs: ' . CurlHelper::getCurlMultiErrorName($error), $error);
133: }
134: } while ($error === CURLM_CALL_MULTI_PERFORM);
135:
136: return $active;
137: }
138:
139: /**
140: * Read finished results from CURL.
141: */
142: private function readResults(): void
143: {
144: while ($info = curl_multi_info_read($this->handler)) {
145: $resourceId = (string) $info['handle'];
146: [$channelId, $name, $request] = $this->resources[$resourceId];
147: $channel = & $this->channels[$channelId];
148:
149: $error = curl_multi_remove_handle($this->handler, $info['handle']);
150: if ($error) {
151: throw new \Dogma\Http\Channel\ChannelException('CURL error when reading results: ' . CurlHelper::getCurlMultiErrorName($error), $error);
152: }
153:
154: $channel->jobFinished($name, $info, $request);
155: unset($this->resources[$resourceId]);
156: }
157: $this->startJobs();
158: }
159:
160: /**
161: * Start requests according to their priorities.
162: */
163: public function startJobs(): void
164: {
165: while ($channelId = $this->selectChannel()) {
166: $this->channels[$channelId]->startJob();
167: }
168: $this->exec();
169: }
170:
171: /**
172: * @return int|string|null
173: */
174: private function selectChannel()
175: {
176: if (count($this->resources) >= $this->threadLimit) {
177: return null;
178: }
179:
180: $selected = null;
181: $ratio = PHP_INT_MIN;
182: foreach ($this->channels as $channelId => &$channel) {
183: if ($selected === $channelId) {
184: continue;
185: }
186: if (!$channel->canStartJob()) {
187: continue;
188: }
189:
190: $channelRatio = ($channel->getPriority() / $this->sumPriorities)
191: - ($channel->getRunningJobCount() / $this->threadLimit);
192:
193: if ($channelRatio > $ratio) {
194: $selected = $channelId;
195: $ratio = $channelRatio;
196: }
197: }
198:
199: return $selected;
200: }
201:
202: /**
203: * Save data for later use.
204: * @param resource $resource
205: * @param \Dogma\Http\Channel\Channel $channel
206: * @param string|int $name
207: * @param \Dogma\Http\Request $request
208: */
209: public function jobStarted($resource, Channel $channel, $name, Request $request): void
210: {
211: $this->resources[(string) $resource] = [spl_object_hash($channel), $name, $request];
212: }
213:
214: public function getHeaderParser(): HeaderParser
215: {
216: if ($this->headerParser === null) {
217: $this->headerParser = new HeaderParser(new CurrentTimeProvider());
218: }
219: return $this->headerParser;
220: }
221:
222: }
| 0 % | Http\Channel\exceptions\ChannelException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http\Channel;
11:
12: class ChannelException extends \Dogma\Http\HttpException
13: {
14:
15: }
| 0 % | Http\Channel\MultiChannel.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http\Channel;
11:
12: use Dogma\Http\Response;
13:
14: class MultiChannel
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var \Dogma\Http\Channel\Channel[] */
19: private $channels;
20:
21: /** @var string[] */
22: private $channelIds;
23:
24: /** @var int */
25: private $lastIndex = -1;
26:
27: /** @var string[][] (string $subJobName => (string $channelName => string $jobName)) */
28: private $queue = [];
29:
30: /** @var \Dogma\Http\Response[][] (string $jobName => (string $channelName => \Dogma\Http\Response $response)) */
31: private $finished = [];
32:
33: /** @var callable */
34: private $responseHandler;
35:
36: /** @var callable */
37: private $redirectHandler;
38:
39: /** @var callable */
40: private $errorHandler;
41:
42: /** @var callable */
43: private $dispatch;
44:
45: /**
46: * @param \Dogma\Http\Channel\Channel[] $channels
47: */
48: public function __construct(array $channels)
49: {
50: $this->channels = $channels;
51:
52: /** @var \Dogma\Http\Channel\Channel $channel */
53: foreach ($channels as $channelName => $channel) {
54: $this->channelIds[spl_object_hash($channel)] = $channelName;
55: $channel->setResponseHandler(function (Response $response, Channel $channel, string $subJobName): void {
56: $this->responseHandler($response, $channel, $subJobName);
57: });
58: }
59: }
60:
61: public function responseHandler(Response $response, Channel $channel, string $subJobName): void
62: {
63: $channelId = spl_object_hash($channel);
64: $channelName = $this->channelIds[$channelId];
65: $jobName = $this->queue[$subJobName][$channelName];
66: $this->finished[$jobName][$channelName] = $response;
67:
68: unset($this->queue[$subJobName][$channelName]);
69: if (empty($this->queue[$subJobName])) {
70: unset($this->queue[$subJobName]);
71: }
72:
73: if (count($this->finished[$jobName]) === count($this->channels)) {
74: $this->jobFinished($jobName);
75: }
76: }
77:
78: /**
79: * @param string|int $jobName
80: */
81: private function jobFinished($jobName): void
82: {
83: /** @var \Dogma\Http\Response $response */
84: foreach ($this->finished[$jobName] as $response) {
85: if ($response->getStatus()->isError()) {
86: $error = true;
87: }
88: if ($response->getStatus()->isRedirect()) {
89: $redirect = true;
90: }
91: }
92:
93: if ($this->errorHandler && isset($error)) {
94: ($this->errorHandler)($this->finished[$jobName], $this);
95: unset($this->finished[$jobName]);
96:
97: } elseif ($this->redirectHandler && isset($redirect)) {
98: ($this->redirectHandler)($this->finished[$jobName], $this);
99: unset($this->finished[$jobName]);
100:
101: } elseif ($this->responseHandler) {
102: ($this->responseHandler)($this->finished[$jobName], $this);
103: unset($this->finished[$jobName]);
104: }
105: }
106:
107: /**
108: * @return \Dogma\Http\Channel\Channel[]
109: */
110: public function getChannels(): array
111: {
112: return $this->channels;
113: }
114:
115: /**
116: * Set callback handler for every response (even an error)
117: * @param callable $responseHandler (\Dogma\Http\Response $response, \Dogma\Http\Channel $channel, string $name)
118: */
119: public function setResponseHandler(callable $responseHandler): void
120: {
121: $this->responseHandler = $responseHandler;
122: }
123:
124: /**
125: * Set separate callback handler for redirects. ResponseHandler will no longer handle these.
126: * @param callable $redirectHandler (\Dogma\Http\Response $response, \Dogma\Http\Channel $channel, string $name)
127: */
128: public function setRedirectHandler(callable $redirectHandler): void
129: {
130: $this->redirectHandler = $redirectHandler;
131: }
132:
133: /**
134: * Set separate callback handler for errors. ResponseHandler will no longer handle these.
135: * @param callable $errorHandler (\Dogma\Http\Response $response, \Dogma\Http\Channel $channel, string $name)
136: */
137: public function setErrorHandler(callable $errorHandler): void
138: {
139: $this->errorHandler = $errorHandler;
140: }
141:
142: /**
143: * @param callable $function (mixed $data, \Dogma\Http\Channel[] $channels)
144: */
145: public function setDispatchFunction(callable $function): void
146: {
147: $this->dispatch = $function;
148: }
149:
150: /**
151: * Add new job to channel queue.
152: * @param string|mixed[] $data
153: * @param mixed $context
154: * @param string|int $name
155: * @return string|int
156: */
157: public function addJob($data, $context = null, $name = null)
158: {
159: if (is_string($name) || is_int($name)) {
160: // ok
161: } elseif ($name === null) {
162: $name = ++$this->lastIndex;
163:
164: } else {
165: throw new \Dogma\Http\Channel\ChannelException('Illegal job name. Job name can be only a string or an integer.');
166: }
167:
168: if ($this->dispatch) {
169: $subJobs = ($this->dispatch)($data, $this->channels);
170: } else {
171: $subJobs = $this->dispatch($data);
172: }
173: foreach ($subJobs as $channel => $job) {
174: $subJobName = $this->channels[$channel]->addJob($job, $context);
175: $this->queue[$subJobName][$channel] = $name;
176: }
177:
178: return $name;
179: }
180:
181: /**
182: * Add more jobs to a channel. Array indexes are job names if they are strings.
183: * @param mixed[] $jobs
184: * @param mixed $context
185: */
186: public function addJobs(array $jobs, $context = null): void
187: {
188: $useKeys = array_keys($jobs) !== range(0, count($jobs) - 1);
189:
190: foreach ($jobs as $name => $data) {
191: $this->addJob($data, $context, $useKeys ? $name : null);
192: }
193: }
194:
195: /**
196: * Run a new job and wait for the response.
197: * @param string|mixed[] $data
198: * @param mixed $context
199: * @return \Dogma\Http\Response[]|null
200: */
201: public function fetchJob($data, $context = null): ?array
202: {
203: $jobs = $this->dispatch($data);
204: foreach ($jobs as $channel => $job) {
205: $jobs[$channel] = $this->channels[$channel]->runJob($job, $context, null);
206: }
207: $responses = [];
208: foreach ($jobs as $channel => $subJobName) {
209: $responses[$channel] = $this->channels[$channel]->fetch($subJobName);
210: }
211: return $responses;
212: }
213:
214: /**
215: * @param string|int $name
216: * @return \Dogma\Http\Response[]|null
217: */
218: public function fetch($name = null): ?array
219: {
220: if ($name !== null) {
221: return $this->fetchNamedJob($name);
222: }
223:
224: if (empty($this->queue) && empty($this->finished)) {
225: return null;
226: }
227:
228: $keys = array_keys($this->channels);
229: do {
230: $this->channels[$keys[0]]->read();
231: foreach ($this->finished as $name => $fin) {
232: if (count($fin) === count($this->channels)) {
233: unset($this->finished[$name]);
234: return $fin;
235: }
236: }
237: } while (true);
238:
239: return null;
240: }
241:
242: /**
243: * @param string|int $name
244: * @return \Dogma\Http\Response[]|null
245: */
246: private function fetchNamedJob($name): ?array
247: {
248: if (!isset($this->queue[$name]) && !isset($this->finished[$name])) {
249: throw new \Dogma\Http\Channel\ChannelException(sprintf('Job named \'%s\' was not found.', $name));
250: }
251:
252: if (isset($this->finished[$name]) && count($this->finished[$name]) === count($this->channels)) {
253: $responses = $this->finished[$name];
254: unset($this->finished[$name]);
255: return $responses;
256: }
257:
258: // seek sub-jobs
259: foreach ($this->queue as $subJobName => $channel) {
260: foreach ($channel as $channelName => $jobName) {
261: if ($jobName === $name) {
262: $this->responseHandler($this->channels[$channelName]->fetch($subJobName), $this->channels[$channelName], $subJobName);
263: }
264: }
265: }
266:
267: $response = $this->finished[$name];
268: unset($this->finished[$name]);
269: return $response;
270: }
271:
272: /**
273: * Wait till all jobs are finished.
274: */
275: public function finish(): void
276: {
277: foreach ($this->channels as $channel) {
278: $channel->finish();
279: }
280: }
281:
282: /**
283: * Check if all channels or a channel or a job are finished.
284: */
285: public function isFinished(): bool
286: {
287: foreach ($this->channels as $channel) {
288: if (!$channel->isFinished()) {
289: return false;
290: }
291: }
292: return true;
293: }
294:
295: public function read(): void
296: {
297: foreach ($this->channels as $channel) {
298: $channel->read();
299: }
300: }
301:
302: /**
303: * Job data dispatch function. Splits up data for sub-jobs (sub-channels). Override if needed.
304: * @param string|mixed[] $data
305: * @return mixed[]
306: */
307: protected function dispatch($data): array
308: {
309: if (is_string($data)) {
310: // default - send copy to all channels
311: $jobs = [];
312: foreach ($this->channels as $name => $channel) {
313: $jobs[$name] = $data;
314: }
315:
316: } elseif (is_array($data)) {
317: // default - array is indexed by channel name
318: return $data;
319:
320: } else {
321: throw new \Dogma\Http\Channel\ChannelException('Illegal job data. Job data can be either string or array.');
322: }
323:
324: return $jobs;
325: }
326:
327: }
| 0 % | Http\Curl\CurlHelper.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http\Curl;
11:
12: class CurlHelper
13: {
14: use \Dogma\StaticClassMixin;
15:
16: // Errors ----------------------------------------------------------------------------------------------------------
17:
18: public static function getCurlErrorName(int $error): string
19: {
20: $constants = get_defined_constants(true);
21: foreach ($constants['curl'] as $name => $value) {
22: if ($value === $error && substr($name, 0, 6) === 'CURLE_') {
23: return $name;
24: }
25: }
26:
27: return 'UNKNOWN_ERROR';
28: }
29:
30: public static function getCurlMultiErrorName(int $error): string
31: {
32: $constants = get_defined_constants(true);
33: $curl = $constants['curl'];
34: foreach ($curl as $name => $value) {
35: if ($value === $error && substr($name, 0, 6) === 'CURLM_') {
36: return $name;
37: }
38: }
39:
40: return 'UNKNOWN_ERROR';
41: }
42:
43: // Options ---------------------------------------------------------------------------------------------------------
44:
45: public static function getCurlOptionNumber(string $name): int
46: {
47: $name = strtoupper($name);
48:
49: return constant('CURLOPT_' . $name);
50: }
51:
52: /**
53: * @param int $option
54: * @return string|null
55: */
56: public static function getCurlOptionName(int $option): ?string
57: {
58: $constants = get_defined_constants(true);
59: foreach ($constants['curl'] as $name => $value) {
60: if ($value === $option && substr($name, 0, 8) === 'CURLOPT_') {
61: return $name;
62: }
63: }
64:
65: return null;
66: }
67:
68: // Info ------------------------------------------------------------------------------------------------------------
69:
70: /**
71: * @param int $number
72: * @return string|null
73: */
74: public static function getCurlInfoName(int $number): ?string
75: {
76: static $translate = [
77: CURLINFO_EFFECTIVE_URL => 'url',
78: CURLINFO_HTTP_CODE => 'http_code',
79: CURLINFO_FILETIME => 'filetime',
80: CURLINFO_TOTAL_TIME => 'total_time',
81: CURLINFO_NAMELOOKUP_TIME => 'namelookup_time',
82: CURLINFO_CONNECT_TIME => 'connect_time',
83: CURLINFO_PRETRANSFER_TIME => 'pretransfer_time',
84: CURLINFO_STARTTRANSFER_TIME => 'starttransfer_time',
85: CURLINFO_REDIRECT_TIME => 'redirect_time',
86: CURLINFO_REDIRECT_COUNT => 'redirect_count',
87: CURLINFO_SIZE_UPLOAD => 'size_upload',
88: CURLINFO_SIZE_DOWNLOAD => 'size_download',
89: CURLINFO_SPEED_DOWNLOAD => 'speed_download',
90: CURLINFO_SPEED_UPLOAD => 'speed_upload',
91: CURLINFO_HEADER_SIZE => 'header_size',
92: CURLINFO_HEADER_OUT => 'request_header',
93: CURLINFO_REQUEST_SIZE => 'request_size',
94: CURLINFO_SSL_VERIFYRESULT => 'ssl_verify_result',
95: CURLINFO_CONTENT_LENGTH_DOWNLOAD => 'download_content_length',
96: CURLINFO_CONTENT_LENGTH_UPLOAD => 'upload_content_length',
97: CURLINFO_CONTENT_TYPE => 'content_type',
98: ];
99: // CURLINFO_PRIVATE
100: // certinfo
101:
102: $constants = get_defined_constants(true);
103: foreach ($constants['curl'] as $name => $value) {
104: if ($value === $number && substr($name, 0, 9) === 'CURLINFO_') {
105: return $translate[$name];
106: }
107: }
108:
109: return null;
110: }
111:
112: }
| 0 % | Http\DownloadRequest.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http;
11:
12: use Dogma\Io\File;
13:
14: /**
15: * File download request.
16: */
17: class DownloadRequest extends \Dogma\Http\Request
18: {
19:
20: /** @var string */
21: private $downloadDir;
22:
23: /** @var \Dogma\Io\File */
24: private $file;
25:
26: public function __construct(string $downloadDir, ?string $url = null, ?string $method = null)
27: {
28: parent::__construct($url, $method);
29:
30: $this->downloadDir = $downloadDir;
31: }
32:
33: /**
34: * @return \Dogma\Http\FileResponse
35: */
36: public function execute(): Response
37: {
38: return parent::execute();
39: }
40:
41: /**
42: * Called by Channel.
43: * @internal
44: */
45: public function prepare(): void
46: {
47: parent::prepare();
48:
49: $this->file = File::createTemporaryFile($this->downloadDir);
50:
51: $this->setOption(CURLOPT_FILE, $this->file->getHandle());
52: $this->setOption(CURLOPT_BINARYTRANSFER, true);
53: }
54:
55: /**
56: * Called by Channel.
57: * @internal
58: *
59: * @param string|bool $response
60: * @param int $error
61: * @return \Dogma\Http\FileResponse
62: */
63: public function createResponse($response, int $error): Response
64: {
65: $info = $this->getInfo();
66: $status = $this->getResponseStatus($error, $info);
67:
68: return new FileResponse($status, $this->file, $this->responseHeaders, $info, $this->context, $this->headerParser);
69: }
70:
71: }
| 0 % | Http\exceptions\HttpException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http;
11:
12: class HttpException extends \RuntimeException
13: {
14:
15: //
16:
17: }
| 0 % | Http\exceptions\RequestException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http;
11:
12: class RequestException extends \Dogma\Http\HttpException
13: {
14:
15: //
16:
17: }
| 0 % | Http\exceptions\ResponseException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http;
11:
12: class ResponseException extends \Dogma\Http\HttpException
13: {
14:
15: //
16:
17: }
| 0 % | Http\FileResponse.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http;
11:
12: use Dogma\Io\File;
13:
14: class FileResponse extends \Dogma\Http\Response
15: {
16:
17: /** @var \Dogma\Io\File */
18: private $file;
19:
20: /**
21: * @param \Dogma\Http\ResponseStatus $status
22: * @param \Dogma\Io\File $file
23: * @param string[] $rawHeaders
24: * @param string[] $info
25: * @param mixed $context
26: * @param \Dogma\Http\HeaderParser $headerParser
27: */
28: public function __construct(ResponseStatus $status, File $file, array $rawHeaders, array $info, $context, ?HeaderParser $headerParser = null)
29: {
30: parent::__construct($status, null, $rawHeaders, $info, $context, $headerParser);
31:
32: $this->file = $file;
33: }
34:
35: public function getFile(): File
36: {
37: return $this->file;
38: }
39:
40: }
| 0 % | Http\HeaderParser.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http;
11:
12: use Dogma\Check;
13: use Dogma\Io\ContentType\ContentType;
14: use Dogma\Language\Encoding;
15: use Dogma\Language\Locale\Locale;
16: use Dogma\Str;
17: use Dogma\Time\DateTime;
18: use Dogma\Time\TimeProvider;
19: use Dogma\Type;
20: use Dogma\Web\Host;
21: use Dogma\Web\Url;
22:
23: class HeaderParser
24: {
25: use \Dogma\StrictBehaviorMixin;
26:
27: /** @var string[] */
28: private static $types = [
29: HttpHeader::AGE => Type::INT,
30: HttpHeader::CONTENT_LANGUAGE => Locale::class,
31: HttpHeader::CONTENT_LENGTH => Type::INT,
32: HttpHeader::CONTENT_TYPE => ContentType::class,
33: HttpHeader::DATE => DateTime::class,
34: HttpHeader::EXPIRES => DateTime::class,
35: HttpHeader::HOST => Host::class,
36: HttpHeader::IF_MODIFIED_SINCE => DateTime::class,
37: HttpHeader::IF_UNMODIFIED_SINCE => DateTime::class,
38: HttpHeader::LAST_MODIFIED => DateTime::class,
39: HttpHeader::LOCATION => Url::class,
40: HttpHeader::MAX_FORWARDS => Type::INT,
41: HttpHeader::ORIGIN => Url::class,
42: HttpHeader::REFERER => Url::class,
43: HttpHeader::X_FORWARDED_HOST => Host::class,
44: HttpHeader::X_WAP_PROFILE => Url::class,
45: ];
46:
47: /** @var \Dogma\Time\TimeProvider */
48: private $timeProvider;
49:
50: public function __construct(TimeProvider $timeProvider)
51: {
52: $this->timeProvider = $timeProvider;
53: }
54:
55: /**
56: * @param string[] $rawHeaders
57: * @return mixed[]
58: */
59: public function parseHeaders(array $rawHeaders): array
60: {
61: $headers = [];
62:
63: $versionAndStatus = array_shift($rawHeaders);
64: $parts = Str::match($versionAndStatus, '~HTTP/(\d\.\d)\s(\d\d\d)\s(.*)~');
65: if ($parts !== null) {
66: $headers[HttpHeader::HTTP_VERSION] = $parts[1];
67: $headers[HttpHeader::STATUS] = $parts[2] . ' ' . $parts[3];
68: } else {
69: array_unshift($rawHeaders, $versionAndStatus);
70: }
71:
72: foreach ($rawHeaders as $header) {
73: [$name, $value] = Str::splitByFirst($header, ':');
74: $name = HttpHeader::normalizeName(trim($name));
75:
76: if ($name === HttpHeader::CONTENT_TYPE && Str::contains($value, ';')) {
77: [$value, $charset] = Str::splitByFirst($value, ';');
78: $charset = Str::fromFirst($charset, '=');
79: $this->insertHeader($headers, HttpHeader::CONTENT_CHARSET, $this->formatValue(trim($charset), Encoding::class));
80: }
81:
82: $type = self::$types[$name] ?? null;
83: if ($type !== null) {
84: $this->insertHeader($headers, $name, $this->formatValue(trim($value), $type));
85: } else {
86: $this->insertHeader($headers, $name, trim($value));
87: }
88: }
89:
90: return $headers;
91: }
92:
93: /**
94: * @param string|string[] $rawCookies
95: * @return string[]
96: */
97: public function parseCookies($rawCookies): array
98: {
99: if (!is_array($rawCookies)) {
100: $rawCookies = [$rawCookies];
101: }
102:
103: $cookies = [];
104: foreach ($rawCookies as $cookie) {
105: $parts = explode(';', $cookie);
106: [$name, $value] = explode('=', trim($parts[0]));
107: $cookies[$name] = $value;
108: }
109:
110: return $cookies;
111: }
112:
113: /**
114: * @param mixed[] $headers
115: * @param string $name
116: * @param mixed $value
117: */
118: private function insertHeader(array &$headers, string $name, $value): void
119: {
120: if (isset($headers[$name])) {
121: if (is_array($headers[$name])) {
122: $headers[$name][] = $value;
123: } else {
124: $headers[$name] = [$headers[$name], $value];
125: }
126: } else {
127: $headers[$name] = $value;
128: }
129: }
130:
131: /**
132: * @param string $value
133: * @param string $type
134: * @return string|int|\Dogma\Time\DateTime|\Dogma\Web\Host|\Dogma\Web\Url|\Dogma\Io\ContentType\ContentType|\Dogma\Language\Encoding|\Dogma\Language\Locale\Locale
135: */
136: private function formatValue(string $value, string $type)
137: {
138: switch ($type) {
139: case Type::INT:
140: Check::int($value);
141: return $value;
142: case DateTime::class:
143: return DateTime::createFromFormat(DateTime::FORMAT_EMAIL_HTTP, $value)
144: ->setTimezone($this->timeProvider->getTimeZone());
145: case Host::class:
146: [$host, $port] = Str::splitByFirst($value, ':');
147: return new Host($host, $port);
148: case Url::class:
149: return new Url($value);
150: case ContentType::class:
151: return ContentType::get($value);
152: case Encoding::class:
153: return Encoding::get($value);
154: case Locale::class:
155: return Locale::get($value);
156: default:
157: return $value;
158: }
159: }
160:
161: }
| 0 % | Http\HttpHeader.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: // spell-check-ignore: SVC DNT TE TSV ATT PROTO Proto UIDH et te deviceid uidh ua att tsv dnt
11:
12: namespace Dogma\Http;
13:
14: class HttpHeader extends \Dogma\Enum\PartialStringEnum
15: {
16:
17: // IETF
18: public const ACCEPT = 'Accept';
19: public const ACCEPT_CHARSET = 'Accept-Charset';
20: public const ACCEPT_DATETIME = 'Accept-Datetime';
21: public const ACCEPT_ENCODING = 'Accept-Encoding';
22: public const ACCEPT_LANGUAGE = 'Accept-Language';
23: public const ACCEPT_PATCH = 'Accept-Patch';
24: public const ACCEPT_RANGES = 'Accept-Ranges';
25: public const ACCESS_CONTROL_ALLOW_ORIGIN = 'Access-Control-Allow-Origin';
26: public const AGE = 'Age';
27: public const ALLOW = 'Allow';
28: public const ALT_SVC = 'Alt-Svc';
29: public const AUTHORIZATION = 'Authorization';
30: public const CACHE_CONTROL = 'Cache-Control';
31: public const CONNECTION = 'Connection';
32: public const COOKIE = 'Cookie';
33: public const CONTENT_DISPOSITION = 'Content-Disposition';
34: public const CONTENT_ENCODING = 'Content-Encoding';
35: public const CONTENT_LANGUAGE = 'Content-Language';
36: public const CONTENT_LENGTH = 'Content-Length';
37: public const CONTENT_LOCATION = 'Content-Location';
38: public const CONTENT_MD5 = 'Content-MD5';
39: public const CONTENT_RANGE = 'Content-Range';
40: public const CONTENT_SECURITY_POLICY = 'Content-Security-Policy';
41: public const CONTENT_TYPE = 'Content-Type';
42: public const DATE = 'Date';
43: public const DNT = 'DNT';
44: public const EXPECT = 'Expect';
45: public const ET = 'ET';
46: public const ETAG = 'ETag';
47: public const EXPIRES = 'Expires';
48: public const FORWARDED = 'Forwarded';
49: public const FROM = 'From';
50: public const HOST = 'Host';
51: public const IF_MATCH = 'If-Match';
52: public const IF_MODIFIED_SINCE = 'If-Modified-Since';
53: public const IF_NONE_MATCH = 'If-None-Match';
54: public const IF_RANGE = 'If-Range';
55: public const IF_UNMODIFIED_SINCE = 'If-Unmodified-Since';
56: public const LAST_MODIFIED = 'Last-Modified';
57: public const LINK = 'Link';
58: public const LOCATION = 'Location';
59: public const MAX_FORWARDS = 'Max-Forwards';
60: public const ORIGIN = 'Origin';
61: public const P3P = 'P3P';
62: public const PRAGMA = 'Pragma';
63: public const PROXY_AUTHENTICATE = 'Proxy-Authenticate';
64: public const PROXY_AUTHORIZATION = 'Proxy-Authorization';
65: public const PUBLIC_KEY_PINS = 'Public-Key-Pins';
66: public const RANGE = 'Range';
67: public const REFERER = 'Referer';
68: public const REFRESH = 'Refresh';
69: public const RETRY_AFTER = 'Retry-After';
70: public const SAVE_DATA = 'Save-Data';
71: public const SERVER = 'Server';
72: public const SET_COOKIE = 'Set-Cookie';
73: public const STATUS = 'Status';
74: public const STRICT_TRANSPORT_SECURITY = 'Strict-Transport-Security';
75: public const TE = 'TE';
76: public const TRAILER = 'Trailer';
77: public const TRANSFER_ENCODING = 'Transfer-Encoding';
78: public const TSV = 'TSV';
79: public const USER_AGENT = 'User-Agent';
80: public const UPGRADE = 'Upgrade';
81: public const VARY = 'Vary';
82: public const VIA = 'Via';
83: public const WARNING = 'Warning';
84: public const WWW_AUTHENTICATE = 'WWW-Authenticate';
85: public const X_FRAME_OPTIONS = 'X-Frame-Options';
86:
87: // non-standard
88: public const CONTENT_CHARSET = 'Content-Charset';
89: public const FRONT_END_HTTPS = 'Front-End-Https';
90: public const HTTP_VERSION = 'Http-Version';
91: public const PROXY_CONNECTION = 'Proxy-Connection';
92: public const UPGRADE_INSECURE_REQUESTS = 'Upgrade-Insecure-Requests';
93: public const X_ATT_DEVICE_ID = 'X-ATT-DeviceId';
94: public const X_CONTENT_DURATION = 'X-Content-Duration';
95: public const X_CONTENT_SECURITY_POLICY = 'X-Content-Security-Policy';
96: public const X_CONTENT_TYPE_OPTIONS = 'X-Content-Type-Options';
97: public const X_CORRELATION_ID = 'X-Correlation-ID';
98: public const X_CSRF_TOKEN = 'X-Csrf-Token';
99: public const X_DO_NOT_TRACK = 'X-Do-Not-Track';
100: public const X_FORWARDED_FOR = 'X-Forwarded-For';
101: public const X_FORWARDED_HOST = 'X-Forwarded-Host';
102: public const X_FORWARDED_PROTO = 'X-Forwarded-Proto';
103: public const X_HTTP_METHOD_OVERRIDE = 'X-Http-Method-Override';
104: public const X_POWERED_BY = 'X-Powered-By';
105: public const X_REQUEST_ID = 'X-Request-ID';
106: public const X_REQUESTED_WITH = 'X-Requested-With';
107: public const X_UA_COMPATIBLE = 'X-UA-Compatible';
108: public const X_UIDH = 'X-UIDH';
109: public const X_XSS_PROTECTION = 'X-XSS-Protection';
110: public const X_WAP_PROFILE = 'X-Wap-Profile';
111: public const X_WEBKIT_CSP = 'X-WebKit-CSP';
112:
113: /** @var string[] */
114: private static $exceptions = [
115: 'et' => 'ET',
116: 'etag' => 'ETag',
117: 'te' => 'TE',
118: 'dnt' => 'DNT',
119: 'tsv' => 'TSV',
120: 'x-att-deviceid' => 'X-ATT-DeviceId',
121: 'x-correlation-id' => 'X-Correlation-ID',
122: 'x-request-id' => 'X-Request-ID',
123: 'x-ua-compatible' => 'X-UA-Compatible',
124: 'x-uidh' => 'X-UIDH',
125: 'x-xss-protection' => 'X-XSS-Protection',
126: 'x-webkit-csp' => 'X-WebKit-CSP',
127: 'www-authenticate' => 'WWW-Authenticate',
128: ];
129:
130: public static function normalizeName(string $name): string
131: {
132: $name = strtolower($name);
133:
134: if (isset(self::$exceptions[$name])) {
135: return self::$exceptions[$name];
136: }
137:
138: return implode('-', array_map('ucfirst', explode('-', $name)));
139: }
140:
141: public static function validateValue(string &$value): bool
142: {
143: $value = self::normalizeName($value);
144:
145: return parent::validateValue($value);
146: }
147:
148: public static function getValueRegexp(): string
149: {
150: return '(?:X-)?[A-Z][a-z]+(?:[A-Z][a-z]+)*|' . implode('|', self::$exceptions);
151: }
152:
153: }
| 0 % | Http\HttpMethod.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http;
11:
12: class HttpMethod extends \Dogma\Enum\StringEnum
13: {
14:
15: public const GET = 'get';
16: public const HEAD = 'head';
17: public const POST = 'post';
18: public const PUT = 'put';
19: public const PATCH = 'patch';
20: public const DELETE = 'delete';
21: public const TRACE = 'trace';
22: public const OPTIONS = 'options';
23: public const CONNECT = 'connect';
24:
25: }
| 0 % | Http\Request.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http;
11:
12: use Dogma\Http\Curl\CurlHelper;
13:
14: /**
15: * HTTP request. Holds a CURL resource.
16: */
17: class Request
18: {
19: use \Dogma\StrictBehaviorMixin;
20: use \Dogma\NonSerializableMixin;
21:
22: /** @var resource (curl) */
23: private $curl;
24:
25: /** @var callable|null */
26: private $init;
27:
28: /** @var string */
29: private $url;
30:
31: /** @var string */
32: private $method = HttpMethod::GET;
33:
34: /** @var string[] */
35: private $headers = [];
36:
37: /** @var string[] */
38: private $cookies = [];
39:
40: /** @var mixed[] */
41: private $variables = [];
42:
43: /** @var string */
44: private $content;
45:
46: /** @var \Dogma\Http\HeaderParser|null */
47: protected $headerParser;
48:
49: /** @var mixed */
50: protected $context;
51:
52: /** @var string[] */
53: protected $responseHeaders = [];
54:
55: public function __construct(?string $url = null, ?string $method = null)
56: {
57: error_clear_last();
58: $curl = curl_init();
59: if ($curl === false) {
60: throw new \Dogma\Http\RequestException(sprintf('Cannot initialize curl. Error: %s', error_get_last()['message']));
61: }
62: $this->curl = $curl;
63:
64: if ($url !== null) {
65: $this->setUrl($url);
66: }
67: if ($method !== null) {
68: $this->setMethod($method);
69: }
70:
71: $this->setHeaderFunction();
72: }
73:
74: /**
75: * Called by Channel.
76: * @internal
77: */
78: public function init(): void
79: {
80: if ($this->init !== null) {
81: if (!($this->init)($this)) {
82: throw new \Dogma\Http\RequestException('Request initialization failed!');
83: }
84: $this->init = null;
85: }
86: }
87:
88: /**
89: * @param callable $init
90: */
91: public function setInit(callable $init): void
92: {
93: $this->init = $init;
94: }
95:
96: public function setHeaderParser(HeaderParser $headerParser): void
97: {
98: $this->headerParser = $headerParser;
99: }
100:
101: public function getHeaderParser(): ?HeaderParser
102: {
103: return $this->headerParser;
104: }
105:
106: /**
107: * @param mixed $data
108: */
109: public function setContext($data): void
110: {
111: $this->context = $data;
112: }
113:
114: /**
115: * @return mixed
116: */
117: public function getContext()
118: {
119: return $this->context;
120: }
121:
122: // basic operations ------------------------------------------------------------------------------------------------
123:
124: /**
125: * @param string $url
126: */
127: public function setUrl(string $url): void
128: {
129: $this->url = $url;
130: }
131:
132: /**
133: * @param string $url
134: */
135: public function appendUrl(string $url): void
136: {
137: $this->setUrl($this->url . $url);
138: }
139:
140: /**
141: * @param mixed $data
142: */
143: public function setData($data): void
144: {
145: if ($data !== null) {
146: $this->dispatch($data);
147: }
148: }
149:
150: /**
151: * @param string|mixed[] $data
152: */
153: protected function dispatch($data): void
154: {
155: if (is_string($data)) {
156: $this->setContent($data);
157:
158: } elseif (is_array($data)) {
159: $this->setVariables($data);
160:
161: } else {
162: throw new \Dogma\Http\RequestException('Job data may be only a string or array!');
163: }
164: }
165:
166: public function setContent(string $data): void
167: {
168: if ($this->method === HttpMethod::POST || $this->method === HttpMethod::PUT) {
169: $this->content = $data;
170: } else {
171: $this->appendUrl($data);
172: }
173: }
174:
175: /**
176: * Set URL or POST variables. Can be called repeatedly.
177: * @param mixed[] $variables
178: */
179: public function setVariables(array $variables): void
180: {
181: $this->variables = array_merge($this->variables, $variables);
182: }
183:
184: public function setMethod(string $method): void
185: {
186: $this->method = strtolower($method);
187:
188: switch ($this->method) {
189: case HttpMethod::GET:
190: $this->setOption(CURLOPT_HTTPGET, true);
191: break;
192: case HttpMethod::HEAD:
193: $this->setOption(CURLOPT_NOBODY, true);
194: break;
195: case HttpMethod::POST:
196: $this->setOption(CURLOPT_POST, true);
197: break;
198: case HttpMethod::PUT:
199: $this->setOption(CURLOPT_PUT, true);
200: break;
201: case HttpMethod::PATCH:
202: case HttpMethod::DELETE:
203: case HttpMethod::TRACE:
204: case HttpMethod::OPTIONS:
205: case HttpMethod::CONNECT:
206: $this->setOption(CURLOPT_CUSTOMREQUEST, $this->method);
207: break;
208: default:
209: throw new \Dogma\Http\RequestException(sprintf('Unknown method \'%s\'!', $this->method));
210: }
211: }
212:
213: /**
214: * @param string|int $name option name or CURLOPT_ constant
215: * @param mixed $value
216: */
217: public function setOption($name, $value): void
218: {
219: if (is_string($name)) {
220: $number = CurlHelper::getCurlOptionNumber($name);
221: if (is_null($number)) {
222: throw new \Dogma\Http\RequestException(sprintf('Unknown CURL option \'%s\'!', $name));
223: }
224:
225: } elseif (!is_int($name)) {
226: throw new \Dogma\Http\RequestException('Option name must be a string or a CURLOPT_* constant!');
227:
228: } else {
229: $number = $name;
230: }
231:
232: if (!curl_setopt($this->curl, $number, $value)) {
233: throw new \Dogma\Http\RequestException('Invalid CURL option.');
234: }
235: }
236:
237: // connection options ----------------------------------------------------------------------------------------------
238:
239: /**
240: * @param float|int $timeout
241: * @param float|int $connectTimeout
242: */
243: public function setTimeout($timeout, $connectTimeout = null): void
244: {
245: if ($timeout < 1) {
246: $this->setOption(CURLOPT_TIMEOUT_MS, (int) ($timeout / 1000));
247: } else {
248: $this->setOption(CURLOPT_TIMEOUT, (int) $timeout);
249: }
250:
251: if (is_null($connectTimeout)) {
252: return;
253: }
254:
255: if ($connectTimeout < 1) {
256: $this->setOption(CURLOPT_CONNECTTIMEOUT_MS, (int) ($connectTimeout / 1000));
257: } else {
258: $this->setOption(CURLOPT_CONNECTTIMEOUT, (int) $connectTimeout);
259: }
260: }
261:
262: public function setFollowRedirects(bool $follow = true, ?int $max = null): void
263: {
264: $this->setOption(CURLOPT_FOLLOWLOCATION, $follow);
265: if (!is_null($max)) {
266: $this->setOption(CURLOPT_MAXREDIRS, (int) $max);
267: }
268: }
269:
270: public function addHeader(string $name, string $value): void
271: {
272: $this->headers[$name] = $value;
273: }
274:
275: /**
276: * @param string[] $headers
277: */
278: public function setHeaders(array $headers): void
279: {
280: $this->headers = $headers;
281: }
282:
283: public function setReferrer(string $url): void
284: {
285: $this->setOption(CURLOPT_REFERER, $url);
286: }
287:
288: public function setUserAgent(string $string): void
289: {
290: $this->setOption(CURLOPT_USERAGENT, $string);
291: }
292:
293: // cookies, authentication & secure connection ---------------------------------------------------------------------
294:
295: public function setCookieFile(string $inputFile, ?string $outputFile = null): void
296: {
297: if ($inputFile) {
298: $this->setOption(CURLOPT_COOKIEFILE, $inputFile);
299: }
300: if ($outputFile) {
301: $this->setOption(CURLOPT_COOKIEJAR, $outputFile);
302: }
303: }
304:
305: /**
306: * @param string[] $cookies
307: */
308: public function setCookies(array $cookies): void
309: {
310: $this->cookies = $cookies;
311: }
312:
313: public function addCookie(string $name, string $value): void
314: {
315: $this->cookies[$name] = $value;
316: }
317:
318: public function setCredentials(string $userName, string $password, int $method = CURLAUTH_ANYSAFE): void
319: {
320: $this->setOption(CURLOPT_USERPWD, $userName . ':' . $password);
321: $this->setOption(CURLOPT_HTTPAUTH, $method);
322: }
323:
324: public function setSslKey(string $keyFile, string $password, string $keyType = 'PEM'): void
325: {
326: $this->setOption(CURLOPT_SSLKEY, $keyFile);
327: $this->setOption(CURLOPT_SSLKEYPASSWD, $password);
328: $this->setOption(CURLOPT_SSLKEYTYPE, $keyType);
329: }
330:
331: public function setVerifySslCertificates(bool $verifyPeer = true, bool $verifyHost = true): void
332: {
333: $this->setOption(CURLOPT_SSL_VERIFYPEER, $verifyPeer);
334: $this->setOption(CURLOPT_SSL_VERIFYHOST, $verifyHost);
335: }
336:
337: public function setProxy(?string $proxy = null, int $port = 3128, ?string $userName = null, ?string $password = null): void
338: {
339: if ($proxy === null) {
340: $this->setOption(CURLOPT_PROXY, null);
341: $this->setOption(CURLOPT_PROXYPORT, null);
342: $this->setOption(CURLOPT_PROXYUSERPWD, null);
343: } else {
344: $this->setOption(CURLOPT_PROXY, $proxy);
345: $this->setOption(CURLOPT_PROXYPORT, $port);
346: $this->setOption(CURLOPT_PROXYUSERPWD, ($userName && $password) ? $userName . ':' . $password : null);
347: }
348: }
349:
350: // output handling -------------------------------------------------------------------------------------------------
351:
352: public function execute(): Response
353: {
354: $this->init();
355: $this->prepare();
356: $response = curl_exec($this->curl);
357: $error = curl_errno($this->curl);
358:
359: return $this->createResponse($response, $error);
360: }
361:
362: /**
363: * Called by RequestManager.
364: * @internal
365: */
366: public function prepare(): void
367: {
368: $params = $this->analyzeUrl();
369: if ($params || $this->variables || $this->content) {
370: $this->prepareData($params);
371: }
372:
373: $this->setOption(CURLOPT_URL, $this->url);
374: $this->setOption(CURLOPT_RETURNTRANSFER, true);
375:
376: if ($this->headers) {
377: $this->prepareHeaders();
378: }
379: if ($this->cookies) {
380: $this->prepareCookies();
381: }
382: }
383:
384: /**
385: * Called by RequestManager.
386: * @internal
387: *
388: * @return resource
389: */
390: public function getHandler()
391: {
392: return $this->curl;
393: }
394:
395: /**
396: * Called by RequestManager.
397: * @internal
398: *
399: * @param string|bool $response
400: * @param int $error
401: * @return \Dogma\Http\Response
402: */
403: public function createResponse($response, int $error): Response
404: {
405: $info = $this->getInfo();
406: $status = $this->getResponseStatus($error, $info);
407:
408: return new Response($status, $response, $this->responseHeaders, $info, $this->context, $this->headerParser);
409: }
410:
411: // internals -------------------------------------------------------------------------------------------------------
412:
413: /**
414: * @return mixed[]
415: */
416: protected function getInfo(): array
417: {
418: $info = curl_getinfo($this->curl);
419: if ($info === false) {
420: throw new \Dogma\Http\RequestException('Info cannot be obtained from CURL.');
421: }
422:
423: return $info;
424: }
425:
426: /**
427: * @param int $error
428: * @param mixed[] $info
429: * @return \Dogma\Http\ResponseStatus
430: */
431: protected function getResponseStatus(int $error, array $info): ResponseStatus
432: {
433: if ($error !== 0) {
434: $status = ResponseStatus::get($error);
435: } else {
436: try {
437: $status = ResponseStatus::get($info['http_code']);
438: } catch (\Dogma\InvalidValueException $e) {
439: $status = ResponseStatus::get(ResponseStatus::UNKNOWN_RESPONSE_CODE);
440: }
441: }
442: if ($status->isFatalError()) {
443: throw new \Dogma\Http\RequestException(sprintf('Fatal error occurred during request execution: %s', $status->getConstantName()), $status->getValue());
444: }
445:
446: return $status;
447: }
448:
449: private function prepareHeaders(): void
450: {
451: $headers = [];
452: foreach ($this->headers as $key => $value) {
453: if (is_int($key)) {
454: $headers[] = $value;
455: } else {
456: $headers[] = $key . ': ' . $value;
457: }
458: }
459:
460: $this->setOption(CURLOPT_HTTPHEADER, $headers);
461: }
462:
463: private function prepareCookies(): void
464: {
465: $cookie = '';
466: foreach ($this->cookies as $name => $value) {
467: $cookie .= sprintf('; %s=%s', $name, $value);
468: }
469:
470: $this->setOption(CURLOPT_COOKIE, substr($cookie, 2));
471: }
472:
473: /**
474: * @param mixed[] $variables
475: */
476: private function prepareData(array $variables): void
477: {
478: if ($variables) {
479: $this->fillUrlVariables($variables);
480: }
481:
482: if ($this->content !== null && $this->variables !== []) {
483: throw new \Dogma\Http\RequestException('Both data content and variables are set. Only one at a time can be sent!');
484: }
485:
486: if ($this->content) {
487: $this->prepareUpload();
488: }
489:
490: if ($this->variables === []) {
491: return;
492: }
493:
494: if ($this->method === HttpMethod::POST) {
495: $this->preparePost();
496: } else {
497: $names = array_keys($this->variables);
498: throw new \Dogma\Http\RequestException(
499: 'Redundant request variable' . (count($names) > 1 ? 's' : '') . ' \'' . implode("', '", $names) . '\' in request data.'
500: );
501: }
502: }
503:
504: private function prepareUpload(): void
505: {
506: $this->setOption(CURLOPT_BINARYTRANSFER, true);
507:
508: if (substr($this->content, 0, 1) === '@') {
509: $fileName = substr($this->content, 1);
510: $file = fopen($fileName, 'r');
511: if (!$file) {
512: throw new \Dogma\Http\RequestException(sprintf('Could not open file %s.', $fileName));
513: }
514:
515: $this->setOption(CURLOPT_INFILE, $file);
516: $this->setOption(CURLOPT_INFILESIZE, strlen($this->content));
517:
518: } else {
519: $this->setOption(CURLOPT_POSTFIELDS, $this->content);
520: }
521: }
522:
523: private function preparePost(): void
524: {
525: foreach ($this->variables as $name => $value) {
526: if ($value === null) {
527: throw new \Dogma\Http\RequestException(sprintf('POST parameter \'%s\' must be filled.', $name));
528: }
529: }
530: $this->setOption(CURLOPT_POSTFIELDS, $this->variables);
531: $this->variables = [];
532: }
533:
534: /**
535: * @return mixed[]
536: */
537: private function analyzeUrl(): array
538: {
539: $params = [];
540:
541: if (preg_match_all('/\\W([0-9A-Za-z_]+)=%[^0-9A-Fa-f]/', $this->url, $mm, PREG_SET_ORDER)) {
542: foreach ($mm as $m) {
543: $params[$m[1]] = true;
544: }
545: }
546: if (preg_match_all('/{%([0-9A-Za-z_]+)}/', $this->url, $mm, PREG_SET_ORDER)) {
547: foreach ($mm as $m) {
548: $params[$m[1]] = false;
549: }
550: }
551:
552: return $params;
553: }
554:
555: /**
556: * @param mixed[] $vars
557: */
558: private function fillUrlVariables(array $vars): void
559: {
560: foreach ($vars as $name => $short) {
561: if (!isset($this->variables[$name])) {
562: throw new \Dogma\Http\RequestException(sprintf('URL variable \'%s\' is missing in request data.', $name));
563: }
564:
565: if ($short) {
566: $this->url = preg_replace(sprintf('/(?<=\\W%s=)%(?=[^0-9A-Fa-f])/', $name), urlencode($this->variables[$name]), $this->url);
567: } else {
568: $this->url = preg_replace(sprintf('/\\{%%%s\\}/', $name), urlencode($this->variables[$name]), $this->url);
569: }
570:
571: unset($this->variables[$name]);
572: }
573: }
574:
575: final public function __clone()
576: {
577: if ($this->curl) {
578: $this->curl = curl_copy_handle($this->curl);
579: }
580: // need to set the closure to $this again
581: $this->setHeaderFunction();
582: }
583:
584: private function setHeaderFunction(): void
585: {
586: $this->setOption(CURLOPT_HEADERFUNCTION, function ($curl, string $header) {
587: $length = strlen($header);
588: $header = trim($header);
589: if ($header !== '') {
590: $this->responseHeaders[] = $header;
591: }
592:
593: return $length;
594: });
595: }
596:
597: }
| 0 % | Http\Response.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Http;
11:
12: use Dogma\Http\Curl\CurlHelper;
13: use Dogma\Io\ContentType\ContentType;
14: use Dogma\Time\Provider\CurrentTimeProvider;
15:
16: class Response
17: {
18: use \Dogma\StrictBehaviorMixin;
19:
20: /** @var mixed[] */
21: protected $info;
22:
23: /** @var \Dogma\Http\ResponseStatus */
24: private $status;
25:
26: /** @var string[] */
27: private $rawHeaders;
28:
29: /** @var mixed[] */
30: private $headers;
31:
32: /** @var string[] */
33: private $cookies;
34:
35: /** @var string */
36: private $body;
37:
38: /** @var mixed */
39: private $context;
40:
41: /** @var \Dogma\Http\HeaderParser */
42: private $headerParser;
43:
44: /**
45: * @param \Dogma\Http\ResponseStatus $status
46: * @param string|null $body
47: * @param string[] $rawHeaders
48: * @param string[] $info
49: * @param mixed $context
50: * @param \Dogma\Http\HeaderParser|null $headerParser
51: */
52: public function __construct(
53: ResponseStatus $status,
54: ?string $body = null,
55: array $rawHeaders,
56: array $info,
57: $context,
58: ?HeaderParser $headerParser = null
59: ) {
60: $this->status = $status;
61: $this->body = $body;
62: $this->rawHeaders = $rawHeaders;
63: $this->info = $info;
64: $this->context = $context;
65: $this->headerParser = $headerParser;
66: }
67:
68: /**
69: * @return mixed
70: */
71: public function getContext()
72: {
73: return $this->context;
74: }
75:
76: public function isSuccess(): bool
77: {
78: return $this->status->isOk();
79: }
80:
81: public function getStatus(): ResponseStatus
82: {
83: return $this->status;
84: }
85:
86: public function getBody(): string
87: {
88: return $this->body;
89: }
90:
91: /**
92: * @return string[]
93: */
94: public function getHeaders(): array
95: {
96: if ($this->headers === null) {
97: $this->headers = $this->getHeaderParser()->parseHeaders($this->rawHeaders);
98: }
99: return $this->headers;
100: }
101:
102: /**
103: * @param string $name
104: * @return string|string[]|int|\Dogma\Time\DateTime|\Dogma\Web\Host|\Dogma\Web\Url|\Dogma\Io\ContentType\ContentType|\Dogma\Language\Encoding|\Dogma\Language\Locale\Locale
105: */
106: public function getHeader(string $name)
107: {
108: if ($this->headers === null) {
109: $this->getHeaders();
110: }
111: return $this->headers[$name] ?? null;
112: }
113:
114: private function getHeaderParser(): HeaderParser
115: {
116: if ($this->headerParser === null) {
117: $this->headerParser = new HeaderParser(new CurrentTimeProvider());
118: }
119: return $this->headerParser;
120: }
121:
122: /**
123: * @return string[]
124: */
125: public function getCookies(): array
126: {
127: if ($this->cookies === null) {
128: $cookies = $this->getHeader(HttpHeader::COOKIE);
129: if ($cookies === null) {
130: return [];
131: }
132: $this->cookies = $this->getHeaderParser()->parseCookies($cookies);
133: }
134:
135: return $this->cookies;
136: }
137:
138: /**
139: * @return \Dogma\Io\ContentType\ContentType|null
140: */
141: public function getContentType(): ?ContentType
142: {
143: return $this->getHeader(HttpHeader::CONTENT_TYPE);
144: }
145:
146: /**
147: * @param string|int $name
148: * @return string|string[]
149: */
150: public function getInfo($name = null)
151: {
152: if ($name === null) {
153: return $this->info;
154: }
155:
156: if (is_int($name)) {
157: $id = $name;
158: $name = CurlHelper::getCurlInfoName($id);
159: if ($name === null) {
160: throw new \Dogma\Http\ResponseException(sprintf('Unknown CURL info \'%s\'!', $id));
161: }
162: }
163:
164: return $this->info[$name];
165: }
166:
167: }
| 0 % | Http\ResponseStatus.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: // spell-check-ignore: CONV REQD MALFORMAT RECV CRL PASV RETR PRET CSEQ STOR ACCEPTTIMOUT EPSV recv
11:
12: namespace Dogma\Http;
13:
14: use Dogma\Arr;
15: use Dogma\Check;
16:
17: /**
18: * HTTP 1.1 response status codes and CURL error codes
19: */
20: class ResponseStatus extends \Dogma\Enum\PartialIntEnum
21: {
22:
23: public const S100_CONTINUE = 100;
24: public const S101_SWITCHING_PROTOCOLS = 101;
25: public const S102_PROCESSING = 102;
26: public const S103_CHECKPOINT = 103;
27:
28: public const S200_OK = 200;
29: public const S201_CREATED = 201;
30: public const S202_ACCEPTED = 202;
31: public const S203_NON_AUTHORITATIVE_INFORMATION = 203;
32: public const S204_NO_CONTENT = 204;
33: public const S205_RESET_CONTENT = 205;
34: public const S206_PARTIAL_CONTENT = 206;
35: public const S207_MULTI_STATUS = 207;
36: public const S208_ALREADY_REPORTED = 208;
37: public const S226_IM_USER = 226;
38:
39: public const S300_MULTIPLE_CHOICES = 300;
40: public const S301_MOVED_PERMANENTLY = 301;
41: public const S302_FOUND = 302;
42: public const S303_SEE_OTHER = 303;
43: public const S304_NOT_MODIFIED = 304;
44: public const S305_USE_PROXY = 305;
45: public const S306_SWITCH_PROXY = 306;
46: public const S307_TEMPORARY_REDIRECT = 307;
47: public const S308_RESUME_INCOMPLETE = 308;
48:
49: public const S400_BAD_REQUEST = 400;
50: public const S401_UNAUTHORIZED = 401;
51: public const S402_PAYMENT_REQUIRED = 402;
52: public const S403_FORBIDDEN = 403;
53: public const S404_NOT_FOUND = 404;
54: public const S405_METHOD_NOT_ALLOWED = 405;
55: public const S406_NOT_ACCEPTABLE = 406;
56: public const S407_PROXY_AUTHENTICATION_REQUIRED = 407;
57: public const S408_REQUEST_TIMEOUT = 408;
58: public const S409_CONFLICT = 409;
59: public const S410_GONE = 410;
60: public const S411_LENGTH_REQUIRED = 411;
61: public const S412_PRECONDITION_FAILED = 412;
62: public const S413_REQUESTED_ENTITY_TOO_LARGE = 413;
63: public const S414_REQUEST_URI_TOO_LONG = 414;
64: public const S415_UNSUPPORTED_MEDIA_TYPE = 415;
65: public const S416_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
66: public const S417_EXPECTATION_FAILED = 417;
67: public const S418_IM_A_TEAPOT = 418;
68: public const S419_AUTHENTICATION_TIMEOUT = 419;
69: public const S420_ENHANCE_YOUR_CALM = 420;
70: public const S421_MISDIRECTED_REQUEST = 421;
71: public const S422_UNPROCESSABLE_ENTITY = 422;
72: public const S423_LOCKED = 423;
73: public const S424_FAILED_DEPENDENCY = 424;
74: public const S425_UNORDERED_COLLECTION = 425;
75: public const S426_UPGRADE_REQUIRED = 426;
76: public const S428_PRECONDITION_REQUIRED = 428;
77: public const S429_TOO_MANY_REQUESTS = 429;
78: public const S431_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
79: public const S449_RETRY_WITH = 449;
80: public const S450_BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS = 450;
81: public const S451_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
82:
83: public const S500_INTERNAL_SERVER_ERROR = 500;
84: public const S501_NOT_IMPLEMENTED = 501;
85: public const S502_BAD_GATEWAY = 502;
86: public const S503_SERVICE_UNAVAILABLE = 503;
87: public const S504_GATEWAY_TIMEOUT = 504;
88: public const S505_HTTP_VERSION_NOT_SUPPORTED = 505;
89: public const S506_VARIANT_ALSO_NEGOTIATES = 506;
90: public const S507_INSUFFICIENT_STORAGE = 507;
91: public const S508_LOOP_DETECTED = 508;
92: public const S509_BANDWIDTH_LIMIT_EXCEEDED = 509;
93: public const S510_NOT_EXTENDED = 510;
94: public const S511_NETWORK_AUTHENTICATION_REQUIRED = 511;
95:
96:
97: // system & CURL internals
98: public const FAILED_INIT = 2; // Very early initialization code failed. This is likely to be an internal error or problem; or a resource problem where something fundamental could not get done at init time.
99: public const NOT_BUILT_IN = 4; // (CURLE_URL_MALFORMAT_USER) A requested feature; protocol or option was not found built-in in this libcurl due to a build-time decision. This means that a feature or option was not enabled or explicitly disabled when libcurl was built and in order to get it to function you have to get a rebuilt libcurl.
100: public const OUT_OF_MEMORY = 27; // A memory allocation request failed. This is serious badness and things are severely screwed up if this ever occurs.
101: public const HTTP_POST_ERROR = 34; // This is an odd error that mainly occurs due to internal confusion.
102: public const FUNCTION_NOT_FOUND = 41; // Function not found. A required zlib function was not found.
103: public const BAD_FUNCTION_ARGUMENT = 43; // Internal error. A function was called with a bad parameter.
104: public const SEND_FAIL_REWIND = 65; // When doing a send operation curl had to rewind the data to retransmit; but the rewinding operation failed.
105: public const CONV_FAILED = 75; // Character conversion failed.
106: public const CONV_REQD = 76; // Caller must register conversion callbacks.
107:
108: // file system
109: public const READ_ERROR = 26; // There was a problem reading a local file or an error returned by the read callback.
110: public const WRITE_ERROR = 23; // An error occurred when writing received data to a local file; or an error was returned to libcurl from a write callback.
111: public const COULD_NOT_READ_FILE = 37; // A file given with FILE:// could not be opened. Most likely because the file path does not identify an existing file. Did you check file permissions?
112: public const FILE_SIZE_EXCEEDED = 63; // Maximum file size exceeded.
113:
114: // user error
115: public const UNSUPPORTED_PROTOCOL = 1; // The URL you passed to libcurl used a protocol that this libcurl does not support. The support might be a compile-time option that you did not use; it can be a misspelled protocol string or just a protocol libcurl has no code for.
116: public const URL_MALFORMAT = 3; // The URL was not properly formatted.
117: public const HTTP_RETURNED_ERROR = 22; // (CURLE_HTTP_NOT_FOUND) This is returned if CURLOPT_FAILONERROR is set TRUE and the HTTP server returns an error code that is >= 400.
118: public const BAD_DOWNLOAD_RESUME = 36; // (CURLE_FTP_BAD_DOWNLOAD_RESUME) The download could not be resumed because the specified offset was out of the file boundary.
119: public const UNKNOWN_OPTION = 48; // (CURLE_UNKNOWN_TELNET_OPTION) An option passed to libcurl is not recognized/known. Refer to the appropriate documentation. This is most likely a problem in the program that uses libcurl. The error buffer might contain more specific information about which exact option it concerns.
120: public const BAD_CONTENT_ENCODING = 61; // Unrecognized transfer encoding.
121: public const LOGIN_DENIED = 67; // The remote server denied curl to login
122: public const REMOTE_FILE_NOT_FOUND = 78; // The resource referenced in the URL does not exist.
123:
124: // network/socket
125: public const COULD_NOT_RESOLVE_PROXY = 5; // Could not resolve proxy. The given proxy host could not be resolved.
126: public const COULD_NOT_RESOLVE_HOST = 6; // Could not resolve host. The given remote host was not resolved.
127: public const COULD_NOT_CONNECT = 7; // Failed to connect() to host or proxy.
128: public const INTERFACE_FAILED = 45; // (CURLE_HTTP_PORT_FAILED) Interface error. A specified outgoing interface could not be used. Set which interface to use for outgoing connections' source IP address with CURLOPT_INTERFACE.
129: public const SEND_ERROR = 55; // Failed sending network data.
130: public const RECV_ERROR = 56; // Failure with receiving network data.
131: public const TRY_AGAIN = 81; // [CURL_AGAIN] Socket is not ready for send/recv wait till it's ready and try again. This return code is only returned from curl_easy_recv(3) and curl_easy_send(3)
132:
133: // server
134: public const UNKNOWN_RESPONSE_CODE = -1; // An unknown (not listed above) HTTP response code was received
135: public const RANGE_ERROR = 33; // (CURLE_HTTP_RANGE_ERROR) The server does not support or accept range requests.
136: public const GOT_NOTHING = 52; // Nothing was returned from the server; and under the circumstances; getting nothing is considered an error.
137:
138: // other
139: public const PARTIAL_FILE = 18; // A file transfer was shorter or larger than expected. This happens when the server first reports an expected transfer size; and then delivers data that does not match the previously given size.
140: public const OPERATION_TIMED_OUT = 28; // (CURLE_OPERATION_TIMEOUTED) Operation timeout. The specified time-out period was reached according to the conditions.
141: public const ABORTED_BY_CALLBACK = 42; // Aborted by callback. A callback returned "abort" to libcurl.
142: public const TOO_MANY_REDIRECTS = 47; // Too many redirects. When following redirects; libcurl hit the maximum amount. Set your limit with CURLOPT_MAXREDIRS.
143:
144: // SSL
145: public const SSL_CONNECT_ERROR = 35; // A problem occurred somewhere in the SSL/TLS handshake. You really want the error buffer and read the message there as it pinpoints the problem slightly more. Could be certificates (file formats; paths; permissions); passwords; and others.
146: public const SSL_PEER_FAILED_VERIFICATION = 51; // (CURLE_SSL_PEER_CERTIFICATE) The remote server's SSL certificate or SSH md5 fingerprint was deemed not OK.
147: public const SSL_ENGINE_NOT_FOUND = 53; // The specified crypto engine was not found.
148: public const SSL_ENGINE_SET_FAILED = 54; // Failed setting the selected SSL crypto engine as default!
149: public const SSL_CERT_PROBLEM = 58; // problem with the local client certificate.
150: public const SSL_CIPHER = 59; // Could not use specified cipher.
151: public const SSL_CA_CERT = 60; // Peer certificate cannot be authenticated with known CA certificates.
152: public const SSL_ENGINE_INIT_FAILED = 66; // Initiating the SSL Engine failed.
153: public const SSL_CA_CERT_BAD_FILE = 77; // Problem with reading the SSL CA cert (path? access rights?)
154: public const SSL_SHUTDOWN_FAILED = 80; // Failed to shut down the SSL connection.
155: public const SSL_CRL_BAD_FILE = 82; // Failed to load CRL file
156: public const SSL_ISSUER_ERROR = 83; // Issuer check failed
157:
158:
159: // following errors should not occur in HTTP transfer
160:
161: // FTP
162: public const FTP_WEIRD_SERVER_REPLY = 8; // After connecting to a FTP server; libcurl expects to get a certain reply back. This error code implies that it got a strange or bad reply. The given remote server is probably not an OK FTP server.
163: public const FTP_ACCESS_DENIED = 9; // We were denied access to the resource given in the URL. For FTP; this occurs while trying to change to the remote directory.
164: public const FTP_ACCEPT_FAILED = 10; // (CURLE_FTP_USER_PASSWORD_INCORRECT) While waiting for the server to connect back when an active FTP session is used; an error code was sent over the control connection or similar.
165: public const FTP_WEIRD_PASS_REPLY = 11; // After having sent the FTP password to the server; libcurl expects a proper reply. This error code indicates that an unexpected code was returned.
166: public const FTP_ACCEPT_TIMEOUT = 12; // (CURLE_FTP_WEIRD_USER_REPLY) During an active FTP session while waiting for the server to connect; the CURLOPT_ACCEPTTIMOUT_MS (or the internal default) timeout expired.
167: public const FTP_WEIRD_PASV_REPLY = 13; // libcurl failed to get a sensible result back from the server as a response to either a PASV or a EPSV command. The server is flawed.
168: public const FTP_WEIRD_227_FORMAT = 14; // FTP servers return a 227-line as a response to a PASV command. If libcurl fails to parse that line; this return code is passed back.
169: public const FTP_CANT_GET_HOST = 15; // An internal failure to lookup the host used for the new connection.
170: public const FTP_COULD_NOT_SET_TYPE = 17; // (CURLE_FTP_COULDNT_SET_BINARY) Received an error when trying to set the transfer mode to binary or ASCII.
171: public const FTP_COULD_NOT_RETR_FILE = 19; // This was either a weird reply to a 'RETR' command or a zero byte transfer complete.
172: public const FTP_QUOTE_ERROR = 21; // When sending custom "QUOTE" commands to the remote server; one of the commands returned an error code that was 400 or higher (for FTP) or otherwise indicated unsuccessful completion of the command.
173: public const FTP_UPLOAD_FAILED = 25; // (CURLE_FTP_COULDNT_STOR_FILE) Failed starting the upload. For FTP; the server typically denied the STOR command. The error buffer usually contains the server's explanation for this.
174: public const FTP_PORT_FAILED = 30; // The FTP PORT command returned error. This mostly happens when you haven't specified a good enough address for libcurl to use. See CURLOPT_FTPPORT.
175: public const FTP_COULD_NOT_USE_REST = 31; // The FTP REST command returned error. This should never happen if the server is sane.
176: public const FTP_SSL_FAILED = 64; // (CURLE_FTP_SSL_FAILED) Requested FTP SSL level failed.
177: public const FTP_PRET_FAILED = 84; // The FTP server does not understand the PRET command at all or does not support the given argument. Be careful when using CURLOPT_CUSTOMREQUEST; a custom LIST command will be sent with PRET CMD before PASV as well.
178: public const FTP_BAD_FILE_LIST = 87; // Unable to parse FTP file list (during FTP wildcard downloading).
179: public const FTP_CHUNK_FAILED = 88; // Chunk callback reported error.
180:
181: // TFTP
182: public const TFTP_NOT_FOUND = 68; // File not found on TFTP server.
183: public const TFTP_PERM = 69; // Permission problem on TFTP server.
184: public const TFTP_REMOTE_DISK_FULL = 70; // Out of disk space on the server.
185: public const TFTP_ILLEGAL = 71; // Illegal TFTP operation.
186: public const TFTP_UNKNOWN_ID = 72; // Unknown TFTP transfer ID.
187: public const TFTP_REMOTE_FILE_EXISTS = 73; // File already exists and will not be overwritten.
188: public const TFTP_NO_SUCH_USER = 74; // This error should never be returned by a properly functioning TFTP server.
189:
190: // SSH
191: public const SSH_ERROR = 79; // [CURL_SSH] An unspecified error occurred during the SSH session.
192:
193: // LDAP
194: public const LDAP_CANNOT_BIND = 38; // LDAP cannot bind. LDAP bind operation failed.
195: public const LDAP_SEARCH_FAILED = 39; // LDAP search failed.
196: public const LDAP_INVALID_URL = 62; // Invalid LDAP URL.
197:
198: // Telnet
199: public const TELNET_OPTION_SYNTAX = 49; // A telnet option string was Illegally formatted.
200:
201: // RTSP
202: public const RTSP_CSEQ_ERROR = 85; // Mismatch of RTSP CSeq numbers.
203: public const RTSP_SESSION_ERROR = 86; // Mismatch of RTSP Session Identifiers.
204:
205: /**
206: * Get formatted status name
207: */
208: public function getDescription(): string
209: {
210: $id = $this->getConstantName();
211: if ($id[0] === 'S' && $id[4] === '_') {
212: $id = substr($id, 5);
213: }
214:
215: return ucwords(str_replace(
216: ['http', 'ftp', 'ssh', 'ldap', 'tftp', 'rtsp', 'url', 'ok', '_'],
217: ['HTTP', 'FTP', 'SSH', 'LDAP', 'TFTP', 'RTSP', 'URL', 'OK', ' '],
218: strtolower($id)
219: ));
220: }
221:
222: /**
223: * Is an information/handshaking HTTP response code (1xx)
224: */
225: public function isInfo(): bool
226: {
227: return $this->getValue() >= 100 && $this->getValue() < 200;
228: }
229:
230: /**
231: * Is a positive HTTP response code (2xx)
232: */
233: public function isOk(): bool
234: {
235: return $this->getValue() >= 200 && $this->getValue() < 300;
236: }
237:
238: /**
239: * Is a HTTP redirection code (3xx)
240: */
241: public function isRedirect(): bool
242: {
243: return ($this->getValue() >= 300 && $this->getValue() < 400) || $this->getValue() === self::TOO_MANY_REDIRECTS;
244: }
245:
246: /**
247: * Is an HTTP error response code (4xx or 5xx)
248: */
249: public function isHttpError(): bool
250: {
251: return $this->getValue() >= 400 && $this->getValue() < 600;
252: }
253:
254: /**
255: * Is a CURL error code
256: */
257: public function isCurlError(): bool
258: {
259: return $this->getValue() < 100;
260: }
261:
262: /**
263: * Is an HTTP or CURL error code
264: */
265: public function isError(): bool
266: {
267: return $this->isCurlError() || $this->isHttpError();
268: }
269:
270: /**
271: * Is a network connection error. Possibility of successful retry
272: */
273: public function isNetworkError(): bool
274: {
275: return Arr::contains([
276: self::COULD_NOT_RESOLVE_PROXY,
277: self::COULD_NOT_RESOLVE_HOST,
278: self::COULD_NOT_CONNECT,
279: self::SEND_ERROR, // is this network or system?
280: self::RECV_ERROR, // is this network or system?
281: self::TRY_AGAIN,
282: ], $this->getValue());
283: }
284:
285: /**
286: * CURL errors which should throw an exception immediately. Something is very wrong
287: */
288: public function isFatalError(): bool
289: {
290: return Arr::contains([
291: self::FAILED_INIT,
292: self::OUT_OF_MEMORY,
293: self::UNKNOWN_OPTION,
294: self::SSL_ENGINE_NOT_FOUND,
295: self::SSL_ENGINE_SET_FAILED,
296: self::SSL_CERT_PROBLEM,
297: self::SSL_ENGINE_INIT_FAILED,
298: self::INTERFACE_FAILED,
299: //self::SEND_ERROR,
300: //self::RECV_ERROR,
301: self::CONV_REQD,
302: ], $this->getValue());
303: }
304:
305: public static function validateValue(int &$value): bool
306: {
307: Check::range($value, 1, 999);
308:
309: return true;
310: }
311:
312: public static function getValueRegexp(): string
313: {
314: return '[0-9]{1,3}';
315: }
316:
317: }
| 0 % | Identity\exceptions\IdGeneratorException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Identity;
11:
12: class IdGeneratorException extends \Dogma\Exception
13: {
14:
15: }
| 0 % | Identity\FastUuidV4Generator.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Identity;
4:
5: class FastUuidV4Generator implements \Dogma\Identity\UuidGenerator
6: {
7:
8: public function createId(): string
9: {
10: $uuid = random_bytes(16);
11: $uuid &= "\xFF\xFF\xFF\xFF\xFF\xFF\x0F\xFF\x3F\xFF\xFF\xFF\xFF\xFF\xFF\xFF";
12: $uuid |= "\x00\x00\x00\x00\x00\x00\x40\x00\x80\x00\x00\x00\x00\x00\x00\x00";
13:
14: return $uuid;
15: }
16:
17: }
| 0 % | Identity\SingleServerNonThreadSafeUniqueIdGenerator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Identity;
11:
12: use Dogma\System\Php;
13: use Dogma\Time\Provider\TimeProvider;
14:
15: /**
16: * Unique 63bit (unsigned) integer id generator.
17: *
18: * Based on:
19: * - system time (count of seconds since 2016-01-01, valid till year 2084; 31 bits)
20: * - process id (max 1M process ids; 20 bits)
21: * - counter (max 4K generated ids per second and process; 12 bits)
22: *
23: * Bits:
24: * XSSSSSSS SSSSSSSS SSSSSSSS SSSSSSSS PPPPPPPP PPPPPPPP PPPPCCCC CCCCCCCC
25: * - X is unused (sign)
26: * - S is seconds
27: * - P is process id
28: * - C is counter
29: *
30: * Use for single-server applications only! Do not use if PHP is running as Apache module!
31: * Will break if:
32: * - server time is changed backwards
33: * - running in a multi-threaded environment (Apache mod_php or pthreads extension; more threads with same process id)
34: * - your OS is configured to reuse recently released process ids (two processes with the same id within one second)
35: *
36: * Use Uuid or prefixed Uid for more servers.
37: */
38: class SingleServerNonThreadSafeUniqueIdGenerator implements \Dogma\Identity\UidGenerator
39: {
40: use \Dogma\StrictBehaviorMixin;
41: use \Dogma\NonCloneableMixin;
42: use \Dogma\NonSerializableMixin;
43:
44: // timestamp of 2016-01-01 00:00:00 UTC
45: public const BASE_TIMESTAMP = 1451606400;
46:
47: /** @var \Dogma\Time\Provider\TimeProvider */
48: private $timeProvider;
49:
50: /** @var \DateTimeZone */
51: private $utcTimeZone;
52:
53: /** @var int */
54: private $lastTimestamp;
55:
56: /** @var int */
57: private $pid;
58:
59: /** @var int */
60: private $counter;
61:
62: public function __construct(TimeProvider $timeProvider)
63: {
64: if (Php::is32bit()) {
65: throw new \Dogma\Identity\IdGeneratorException('Cannot safely generate unique ids. Running on a 32bit OS.');
66: }
67: if (Php::isMultithreaded()) {
68: throw new \Dogma\Identity\IdGeneratorException('Cannot safely generate unique ids. Running in multithreaded environment.');
69: }
70:
71: $this->timeProvider = $timeProvider;
72: $this->utcTimeZone = new \DateTimeZone('UTC');
73:
74: // default limit for pid on 32bit Linux is 15 bits (32K). can be configured up to 22 bits (4M) on 64bit Linux
75: // taking only 20 bits (1M) to leave some more space for counter
76: /// todo: check /proc/sys/kernel/pid_max?
77: $pid = getmypid();
78: if ($pid > 0xFFFFF) {
79: throw new \Dogma\Identity\IdGeneratorException('Cannot safely generate unique ids. Process id too high.');
80: }
81: $this->pid = $pid << 12;
82: }
83:
84: public function createId(int $retry = 0): int
85: {
86: $timestamp = $this->timeProvider->getDateTime()->setTimezone($this->utcTimeZone)->getTimestamp();
87: if ($timestamp < $this->lastTimestamp) {
88: throw new \Dogma\Identity\IdGeneratorException('Cannot safely generate unique id. System time has changed.');
89: } elseif ($timestamp === $this->lastTimestamp) {
90: $this->counter++;
91: } else {
92: $this->counter = 0;
93: $this->lastTimestamp = $timestamp;
94: }
95: $seconds = (($timestamp - self::BASE_TIMESTAMP) & 0x7FFFFFFF) << 32;
96:
97: if ($this->counter >= 0xFFF) {
98: if ($retry > 4) {
99: throw new \Dogma\Identity\IdGeneratorException('Cannot safely generate unique id. Counter overflow.');
100: } else {
101: usleep(250000);
102: return $this->createId($retry + 1);
103: }
104: }
105:
106: return $seconds + $this->pid + $this->counter;
107: }
108:
109: }
| 0 % | Identity\UidGenerator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Identity;
11:
12: interface UidGenerator
13: {
14:
15: /**
16: * Generates a 64bit machine unique id
17: * @return int
18: */
19: public function createId(): int;
20:
21: }
| 0 % | Identity\Uuid.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Identity;
11:
12: use Dogma\Check;
13:
14: /**
15: * Simple UUID crate. Not generator, neither parser.
16: */
17: class Uuid
18: {
19:
20: public const TYPE_TIME_MAC = 1;
21: public const TYPE_TIME_MAC_DCE = 2;
22: public const TYPE_NAMESPACE_MD5 = 3;
23: public const TYPE_RANDOM = 4;
24: public const TYPE_NAMESPACE_SHA1 = 5;
25:
26: public const FORMATTED_UUID_PATTERN = '[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}';
27:
28: /** @var int|null */
29: private $type;
30:
31: /** @var string (16,binary) */
32: private $value;
33:
34: /** @var string (36,ascii) */
35: private $formatted;
36:
37: private function __construct()
38: {
39: // pass
40: }
41:
42: public static function fromValue(string $value, ?int $type = null): self
43: {
44: Check::length($value, 16, 16);
45:
46: $self = new static();
47: $self->type = $type;
48: $self->value = $value;
49: $self->formatted = self::format($value);
50:
51: return $self;
52: }
53:
54: public static function fromFormatted(string $formatted, ?int $type = null): self
55: {
56: $formatted = strtoupper($formatted);
57: Check::match($formatted, '/^' . self::FORMATTED_UUID_PATTERN . '$/');
58:
59: $self = new static();
60: $self->type = $type;
61: $self->value = self::unformat($formatted);
62: $self->formatted = $formatted;
63:
64: return $self;
65: }
66:
67: public function getType(): ?int
68: {
69: return $this->type;
70: }
71:
72: public function getValue(): string
73: {
74: return $this->value;
75: }
76:
77: public function getFormatted(): string
78: {
79: return $this->formatted;
80: }
81:
82: public function getHexadec(): string
83: {
84: return str_replace('-', '', $this->formatted);
85: }
86:
87: public static function format(string $value): string
88: {
89: $hexadec = unpack('H*', $value);
90:
91: return sprintf(
92: '%s-%s-%s-%s-%s',
93: substr($hexadec, 0, 8),
94: substr($hexadec, 8, 4),
95: substr($hexadec, 12, 4),
96: substr($hexadec, 16, 4),
97: substr($hexadec, 20, 12)
98: );
99: }
100:
101: public static function unformat(string $value): string
102: {
103: $value = str_replace('-', '', $value);
104:
105: return pack('H*', $value);
106: }
107:
108: public function generateShort(string $uuid): string
109: {
110: $plain = str_replace('-', '', $uuid);
111: $binary = hex2bin($plain);
112: $base64 = base64_encode($binary);
113:
114: return str_replace(['+', '/', '='], ['-', '_', ''], $base64);
115: }
116:
117: }
| 0 % | Identity\UuidGenerator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Identity;
11:
12: interface UuidGenerator
13: {
14:
15: /**
16: * Generates a 128bit UUID
17: * @return string (16,binary)
18: */
19: public function createId(): string;
20:
21: }
| 0 % | Io\ContentType\BaseContentType.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io\ContentType;
11:
12: class BaseContentType extends \Dogma\Enum\PartialStringEnum
13: {
14:
15: public const APPLICATION = 'application';
16: public const AUDIO = 'audio';
17: public const FONT = 'font';
18: public const CHEMICAL = 'chemical';
19: public const IMAGE = 'image';
20: public const MESSAGE = 'message';
21: public const MODEL = 'model';
22: public const MULTIPART = 'multipart';
23: public const TEXT = 'text';
24: public const VIDEO = 'video';
25:
26: public static function getValueRegexp(): string
27: {
28: return '[a-z_]+';
29: }
30:
31: }
| 0 % | Io\ContentType\ContentType.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io\ContentType;
11:
12: use Dogma\Str;
13:
14: class ContentType extends \Dogma\Enum\PartialStringEnum
15: {
16:
17: public const APPLICATION_1D_INTERLEAVED_PARITYFEC = 'application/1d-interleaved-parityfec';
18: public const APPLICATION_3GPDASH_QOE_REPORT_XML = 'application/3gpdash-qoe-report+xml';
19: public const APPLICATION_3GPP_IMS_XML = 'application/3gpp-ims+xml';
20: public const APPLICATION_A2L = 'application/A2L';
21: public const APPLICATION_ACTIVEMESSAGE = 'application/activemessage';
22: public const APPLICATION_ALTO_COSTMAP_JSON = 'application/alto-costmap+json';
23: public const APPLICATION_ALTO_COSTMAPFILTER_JSON = 'application/alto-costmapfilter+json';
24: public const APPLICATION_ALTO_DIRECTORY_JSON = 'application/alto-directory+json';
25: public const APPLICATION_ALTO_ENDPOINTCOST_JSON = 'application/alto-endpointcost+json';
26: public const APPLICATION_ALTO_ENDPOINTCOSTPARAMS_JSON = 'application/alto-endpointcostparams+json';
27: public const APPLICATION_ALTO_ENDPOINTPROP_JSON = 'application/alto-endpointprop+json';
28: public const APPLICATION_ALTO_ENDPOINTPROPPARAMS_JSON = 'application/alto-endpointpropparams+json';
29: public const APPLICATION_ALTO_ERROR_JSON = 'application/alto-error+json';
30: public const APPLICATION_ALTO_NETWORKMAP_JSON = 'application/alto-networkmap+json';
31: public const APPLICATION_ALTO_NETWORKMAPFILTER_JSON = 'application/alto-networkmapfilter+json';
32: public const APPLICATION_AML = 'application/AML';
33: public const APPLICATION_ANDREW_INSET = 'application/andrew-inset';
34: public const APPLICATION_APPLEFILE = 'application/applefile';
35: public const APPLICATION_APPLIXWARE = 'application/applixware';
36: public const APPLICATION_ATF = 'application/ATF';
37: public const APPLICATION_ATFX = 'application/ATFX';
38: public const APPLICATION_ATOM_XML = 'application/atom+xml';
39: public const APPLICATION_ATOMCAT_XML = 'application/atomcat+xml';
40: public const APPLICATION_ATOMDELETED_XML = 'application/atomdeleted+xml';
41: public const APPLICATION_ATOMICMAIL = 'application/atomicmail';
42: public const APPLICATION_ATOMSVC_XML = 'application/atomsvc+xml';
43: public const APPLICATION_ATXML = 'application/ATXML';
44: public const APPLICATION_AUTH_POLICY_XML = 'application/auth-policy+xml';
45: public const APPLICATION_BACNET_XDD_ZIP = 'application/bacnet-xdd+zip';
46: public const APPLICATION_BATCH_SMTP = 'application/batch-SMTP';
47: public const APPLICATION_BEEP_XML = 'application/beep+xml';
48: public const APPLICATION_CALENDAR_JSON = 'application/calendar+json';
49: public const APPLICATION_CALENDAR_XML = 'application/calendar+xml';
50: public const APPLICATION_CALL_COMPLETION = 'application/call-completion';
51: public const APPLICATION_CALS_1840 = 'application/CALS-1840';
52: public const APPLICATION_CBOR = 'application/cbor';
53: public const APPLICATION_CCMP_XML = 'application/ccmp+xml';
54: public const APPLICATION_CCXML_XML = 'application/ccxml+xml';
55: public const APPLICATION_CDFX_XML = 'application/CDFX+XML';
56: public const APPLICATION_CDMI_CAPABILITY = 'application/cdmi-capability';
57: public const APPLICATION_CDMI_CONTAINER = 'application/cdmi-container';
58: public const APPLICATION_CDMI_DOMAIN = 'application/cdmi-domain';
59: public const APPLICATION_CDMI_OBJECT = 'application/cdmi-object';
60: public const APPLICATION_CDMI_QUEUE = 'application/cdmi-queue';
61: public const APPLICATION_CDNI = 'application/cdni';
62: public const APPLICATION_CEA = 'application/CEA';
63: public const APPLICATION_CEA_2018_XML = 'application/cea-2018+xml';
64: public const APPLICATION_CELLML_XML = 'application/cellml+xml';
65: public const APPLICATION_CFW = 'application/cfw';
66: public const APPLICATION_CLUE_INFO_XML = 'application/clue_info+xml';
67: public const APPLICATION_CMS = 'application/cms';
68: public const APPLICATION_CNRP_XML = 'application/cnrp+xml';
69: public const APPLICATION_COAP_GROUP_JSON = 'application/coap-group+json';
70: public const APPLICATION_COAP_PAYLOAD = 'application/coap-payload';
71: public const APPLICATION_COMMONGROUND = 'application/commonground';
72: public const APPLICATION_CONFERENCE_INFO_XML = 'application/conference-info+xml';
73: public const APPLICATION_COSE = 'application/cose';
74: public const APPLICATION_COSE_KEY = 'application/cose-key';
75: public const APPLICATION_COSE_KEY_SET = 'application/cose-key-set';
76: public const APPLICATION_CPL_XML = 'application/cpl+xml';
77: public const APPLICATION_CSRATTRS = 'application/csrattrs';
78: public const APPLICATION_CSTA_XML = 'application/csta+xml';
79: public const APPLICATION_CSTADATA_XML = 'application/CSTAdata+xml';
80: public const APPLICATION_CSVM_JSON = 'application/csvm+json';
81: public const APPLICATION_CU_SEEME = 'application/cu-seeme';
82: public const APPLICATION_CYBERCASH = 'application/cybercash';
83: public const APPLICATION_DASH_XML = 'application/dash+xml';
84: public const APPLICATION_DASHDELTA = 'application/dashdelta';
85: public const APPLICATION_DAVMOUNT_XML = 'application/davmount+xml';
86: public const APPLICATION_DCA_RFT = 'application/dca-rft';
87: public const APPLICATION_DCD = 'application/DCD';
88: public const APPLICATION_DEC_DX = 'application/dec-dx';
89: public const APPLICATION_DIALOG_INFO_XML = 'application/dialog-info+xml';
90: public const APPLICATION_DICOM = 'application/dicom';
91: public const APPLICATION_DICOM_JSON = 'application/dicom+json';
92: public const APPLICATION_DICOM_XML = 'application/dicom+xml';
93: public const APPLICATION_DII = 'application/DII';
94: public const APPLICATION_DIT = 'application/DIT';
95: public const APPLICATION_DNS = 'application/dns';
96: public const APPLICATION_DSKPP_XML = 'application/dskpp+xml';
97: public const APPLICATION_DSSC_DER = 'application/dssc+der';
98: public const APPLICATION_DSSC_XML = 'application/dssc+xml';
99: public const APPLICATION_DVCS = 'application/dvcs';
100: public const APPLICATION_ECMASCRIPT = 'application/ecmascript';
101: public const APPLICATION_EDI_CONSENT = 'application/EDI-consent';
102: public const APPLICATION_EDI_X12 = 'application/EDI-X12';
103: public const APPLICATION_EDIFACT = 'application/EDIFACT';
104: public const APPLICATION_EFI = 'application/efi';
105: public const APPLICATION_EMERGENCYCALLDATA_COMMENT_XML = 'application/EmergencyCallData.Comment+xml';
106: public const APPLICATION_EMERGENCYCALLDATA_DEVICEINFO_XML = 'application/EmergencyCallData.DeviceInfo+xml';
107: public const APPLICATION_EMERGENCYCALLDATA_PROVIDERINFO_XML = 'application/EmergencyCallData.ProviderInfo+xml';
108: public const APPLICATION_EMERGENCYCALLDATA_SERVICEINFO_XML = 'application/EmergencyCallData.ServiceInfo+xml';
109: public const APPLICATION_EMERGENCYCALLDATA_SUBSCRIBERINFO_XML = 'application/EmergencyCallData.SubscriberInfo+xml';
110: public const APPLICATION_EMMA_XML = 'application/emma+xml';
111: public const APPLICATION_EMOTIONML_XML = 'application/emotionml+xml';
112: public const APPLICATION_ENCAPRTP = 'application/encaprtp';
113: public const APPLICATION_EPP_XML = 'application/epp+xml';
114: public const APPLICATION_EPUB_ZIP = 'application/epub+zip';
115: public const APPLICATION_ESHOP = 'application/eshop';
116: public const APPLICATION_EXAMPLE = 'application/example';
117: public const APPLICATION_EXI = 'application/exi';
118: public const APPLICATION_FASTINFOSET = 'application/fastinfoset';
119: public const APPLICATION_FASTSOAP = 'application/fastsoap';
120: public const APPLICATION_FDT_XML = 'application/fdt+xml';
121: public const APPLICATION_FITS = 'application/fits';
122: public const APPLICATION_FONT_SFNT = 'application/font-sfnt';
123: public const APPLICATION_FONT_TDPFR = 'application/font-tdpfr';
124: public const APPLICATION_FONT_WOFF = 'application/font-woff';
125: public const APPLICATION_FRAMEWORK_ATTRIBUTES_XML = 'application/framework-attributes+xml';
126: public const APPLICATION_GEO_JSON = 'application/geo+json';
127: public const APPLICATION_GML_XML = 'application/gml+xml';
128: public const APPLICATION_GZIP = 'application/gzip';
129: public const APPLICATION_H224 = 'application/H224';
130: public const APPLICATION_HELD_XML = 'application/held+xml';
131: public const APPLICATION_HTTP = 'application/http';
132: public const APPLICATION_HYPERSTUDIO = 'application/hyperstudio';
133: public const APPLICATION_IBE_KEY_REQUEST_XML = 'application/ibe-key-request+xml';
134: public const APPLICATION_IBE_PKG_REPLY_XML = 'application/ibe-pkg-reply+xml';
135: public const APPLICATION_IBE_PP_DATA = 'application/ibe-pp-data';
136: public const APPLICATION_IGES = 'application/iges';
137: public const APPLICATION_IM_ISCOMPOSING_XML = 'application/im-iscomposing+xml';
138: public const APPLICATION_INDEX = 'application/index';
139: public const APPLICATION_INDEX_CMD = 'application/index.cmd';
140: public const APPLICATION_INDEX_OBJ = 'application/index-obj';
141: public const APPLICATION_INDEX_RESPONSE = 'application/index.response';
142: public const APPLICATION_INDEX_VND = 'application/index.vnd';
143: public const APPLICATION_INKML_XML = 'application/inkml+xml';
144: public const APPLICATION_IOTP = 'application/IOTP';
145: public const APPLICATION_IPFIX = 'application/ipfix';
146: public const APPLICATION_IPP = 'application/ipp';
147: public const APPLICATION_ISUP = 'application/ISUP';
148: public const APPLICATION_ITS_XML = 'application/its+xml';
149: public const APPLICATION_JAVA_ARCHIVE = 'application/java-archive';
150: public const APPLICATION_JAVA_SERIALIZED_OBJECT = 'application/java-serialized-object';
151: public const APPLICATION_JAVA_VM = 'application/java-vm';
152: public const APPLICATION_JAVASCRIPT = 'application/javascript';
153: public const APPLICATION_JOSE = 'application/jose';
154: public const APPLICATION_JOSE_JSON = 'application/jose+json';
155: public const APPLICATION_JRD_JSON = 'application/jrd+json';
156: public const APPLICATION_JSON = 'application/json';
157: public const APPLICATION_JSON_PATCH_JSON = 'application/json-patch+json';
158: public const APPLICATION_JSON_SEQ = 'application/json-seq';
159: public const APPLICATION_JWK_JSON = 'application/jwk+json';
160: public const APPLICATION_JWK_SET_JSON = 'application/jwk-set+json';
161: public const APPLICATION_JWT = 'application/jwt';
162: public const APPLICATION_KPML_REQUEST_XML = 'application/kpml-request+xml';
163: public const APPLICATION_KPML_RESPONSE_XML = 'application/kpml-response+xml';
164: public const APPLICATION_LD_JSON = 'application/ld+json';
165: public const APPLICATION_LGR_XML = 'application/lgr+xml';
166: public const APPLICATION_LINK_FORMAT = 'application/link-format';
167: public const APPLICATION_LOAD_CONTROL_XML = 'application/load-control+xml';
168: public const APPLICATION_LOST_XML = 'application/lost+xml';
169: public const APPLICATION_LOSTSYNC_XML = 'application/lostsync+xml';
170: public const APPLICATION_LXF = 'application/LXF';
171: public const APPLICATION_MAC_BINHEX40 = 'application/mac-binhex40';
172: public const APPLICATION_MAC_COMPACTPRO = 'application/mac-compactpro';
173: public const APPLICATION_MACWRITEII = 'application/macwriteii';
174: public const APPLICATION_MADS_XML = 'application/mads+xml';
175: public const APPLICATION_MARC = 'application/marc';
176: public const APPLICATION_MARCXML_XML = 'application/marcxml+xml';
177: public const APPLICATION_MATHEMATICA = 'application/mathematica';
178: public const APPLICATION_MATHML_XML = 'application/mathml+xml';
179: public const APPLICATION_MBMS_ASSOCIATED_PROCEDURE_DESCRIPTION_XML = 'application/mbms-associated-procedure-description+xml';
180: public const APPLICATION_MBMS_DEREGISTER_XML = 'application/mbms-deregister+xml';
181: public const APPLICATION_MBMS_ENVELOPE_XML = 'application/mbms-envelope+xml';
182: public const APPLICATION_MBMS_MSK_RESPONSE_XML = 'application/mbms-msk-response+xml';
183: public const APPLICATION_MBMS_MSK_XML = 'application/mbms-msk+xml';
184: public const APPLICATION_MBMS_PROTECTION_DESCRIPTION_XML = 'application/mbms-protection-description+xml';
185: public const APPLICATION_MBMS_RECEPTION_REPORT_XML = 'application/mbms-reception-report+xml';
186: public const APPLICATION_MBMS_REGISTER_RESPONSE_XML = 'application/mbms-register-response+xml';
187: public const APPLICATION_MBMS_REGISTER_XML = 'application/mbms-register+xml';
188: public const APPLICATION_MBMS_SCHEDULE_XML = 'application/mbms-schedule+xml';
189: public const APPLICATION_MBMS_USER_SERVICE_DESCRIPTION_XML = 'application/mbms-user-service-description+xml';
190: public const APPLICATION_MBOX = 'application/mbox';
191: public const APPLICATION_MEDIA_CONTROL_XML = 'application/media_control+xml';
192: public const APPLICATION_MEDIA_POLICY_DATASET_XML = 'application/media-policy-dataset+xml';
193: public const APPLICATION_MEDIASERVERCONTROL_XML = 'application/mediaservercontrol+xml';
194: public const APPLICATION_MERGE_PATCH_JSON = 'application/merge-patch+json';
195: public const APPLICATION_METALINK4_XML = 'application/metalink4+xml';
196: public const APPLICATION_METS_XML = 'application/mets+xml';
197: public const APPLICATION_MF4 = 'application/MF4';
198: public const APPLICATION_MIKEY = 'application/mikey';
199: public const APPLICATION_MODS_XML = 'application/mods+xml';
200: public const APPLICATION_MOSS_KEYS = 'application/moss-keys';
201: public const APPLICATION_MOSS_SIGNATURE = 'application/moss-signature';
202: public const APPLICATION_MOSSKEY_DATA = 'application/mosskey-data';
203: public const APPLICATION_MOSSKEY_REQUEST = 'application/mosskey-request';
204: public const APPLICATION_MP21 = 'application/mp21';
205: public const APPLICATION_MP4 = 'application/mp4';
206: public const APPLICATION_MPEG4_GENERIC = 'application/mpeg4-generic';
207: public const APPLICATION_MPEG4_IOD = 'application/mpeg4-iod';
208: public const APPLICATION_MPEG4_IOD_XMT = 'application/mpeg4-iod-xmt';
209: public const APPLICATION_MRB_CONSUMER_XML = 'application/mrb-consumer+xml';
210: public const APPLICATION_MRB_PUBLISH_XML = 'application/mrb-publish+xml';
211: public const APPLICATION_MSC_IVR_XML = 'application/msc-ivr+xml';
212: public const APPLICATION_MSC_MIXER_XML = 'application/msc-mixer+xml';
213: public const APPLICATION_MSWORD = 'application/msword';
214: public const APPLICATION_MUD_JSON = 'application/mud+json';
215: public const APPLICATION_MXF = 'application/mxf';
216: public const APPLICATION_NASDATA = 'application/nasdata';
217: public const APPLICATION_NEWS_CHECKGROUPS = 'application/news-checkgroups';
218: public const APPLICATION_NEWS_GROUPINFO = 'application/news-groupinfo';
219: public const APPLICATION_NEWS_TRANSMISSION = 'application/news-transmission';
220: public const APPLICATION_NLSML_XML = 'application/nlsml+xml';
221: public const APPLICATION_NSS = 'application/nss';
222: public const APPLICATION_OCSP_REQUEST = 'application/ocsp-request';
223: public const APPLICATION_OCSP_RESPONSE = 'application/ocsp-response';
224: public const APPLICATION_OCTET_STREAM = 'application/octet-stream';
225: public const APPLICATION_ODA = 'application/ODA';
226: public const APPLICATION_ODX = 'application/ODX';
227: public const APPLICATION_OEBPS_PACKAGE_XML = 'application/oebps-package+xml';
228: public const APPLICATION_OGG = 'application/ogg';
229: public const APPLICATION_ONENOTE = 'application/onenote';
230: public const APPLICATION_OXPS = 'application/oxps';
231: public const APPLICATION_P2P_OVERLAY_XML = 'application/p2p-overlay+xml';
232: public const APPLICATION_PATCH_OPS_ERROR_XML = 'application/patch-ops-error+xml';
233: public const APPLICATION_PDF = 'application/pdf';
234: public const APPLICATION_PDX = 'application/pdx';
235: public const APPLICATION_PGP_ENCRYPTED = 'application/pgp-encrypted';
236: public const APPLICATION_PGP_SIGNATURE = 'application/pgp-signature';
237: public const APPLICATION_PICS_RULES = 'application/pics-rules';
238: public const APPLICATION_PIDF_DIFF_XML = 'application/pidf-diff+xml';
239: public const APPLICATION_PIDF_XML = 'application/pidf+xml';
240: public const APPLICATION_PKCS10 = 'application/pkcs10';
241: public const APPLICATION_PKCS12 = 'application/pkcs12';
242: public const APPLICATION_PKCS7_MIME = 'application/pkcs7-mime';
243: public const APPLICATION_PKCS7_SIGNATURE = 'application/pkcs7-signature';
244: public const APPLICATION_PKCS8 = 'application/pkcs8';
245: public const APPLICATION_PKIX_ATTR_CERT = 'application/pkix-attr-cert';
246: public const APPLICATION_PKIX_CERT = 'application/pkix-cert';
247: public const APPLICATION_PKIX_CRL = 'application/pkix-crl';
248: public const APPLICATION_PKIX_PKIPATH = 'application/pkix-pkipath';
249: public const APPLICATION_PKIXCMP = 'application/pkixcmp';
250: public const APPLICATION_PLS_XML = 'application/pls+xml';
251: public const APPLICATION_POC_SETTINGS_XML = 'application/poc-settings+xml';
252: public const APPLICATION_POSTSCRIPT = 'application/postscript';
253: public const APPLICATION_PPSP_TRACKER_JSON = 'application/ppsp-tracker+json';
254: public const APPLICATION_PROBLEM_JSON = 'application/problem+json';
255: public const APPLICATION_PROBLEM_XML = 'application/problem+xml';
256: public const APPLICATION_PROVENANCE_XML = 'application/provenance+xml';
257: public const APPLICATION_PRS_ALVESTRAND_TITRAX_SHEET = 'application/prs.alvestrand.titrax-sheet';
258: public const APPLICATION_PRS_CWW = 'application/prs.cww';
259: public const APPLICATION_PRS_HPUB_ZIP = 'application/prs.hpub+zip';
260: public const APPLICATION_PRS_NPREND = 'application/prs.nprend';
261: public const APPLICATION_PRS_PLUCKER = 'application/prs.plucker';
262: public const APPLICATION_PRS_RDF_XML_CRYPT = 'application/prs.rdf-xml-crypt';
263: public const APPLICATION_PRS_XSF_XML = 'application/prs.xsf+xml';
264: public const APPLICATION_PSKC_XML = 'application/pskc+xml';
265: public const APPLICATION_QSIG = 'application/QSIG';
266: public const APPLICATION_RAPTORFEC = 'application/raptorfec';
267: public const APPLICATION_RDAP_JSON = 'application/rdap+json';
268: public const APPLICATION_RDF_XML = 'application/rdf+xml';
269: public const APPLICATION_REGINFO_XML = 'application/reginfo+xml';
270: public const APPLICATION_RELAX_NG_COMPACT_SYNTAX = 'application/relax-ng-compact-syntax';
271: public const APPLICATION_REMOTE_PRINTING = 'application/remote-printing';
272: public const APPLICATION_REPUTON_JSON = 'application/reputon+json';
273: public const APPLICATION_RESOURCE_LISTS_DIFF_XML = 'application/resource-lists-diff+xml';
274: public const APPLICATION_RESOURCE_LISTS_XML = 'application/resource-lists+xml';
275: public const APPLICATION_RFC_XML = 'application/rfc+xml';
276: public const APPLICATION_RISCOS = 'application/riscos';
277: public const APPLICATION_RLMI_XML = 'application/rlmi+xml';
278: public const APPLICATION_RLS_SERVICES_XML = 'application/rls-services+xml';
279: public const APPLICATION_RPKI_GHOSTBUSTERS = 'application/rpki-ghostbusters';
280: public const APPLICATION_RPKI_MANIFEST = 'application/rpki-manifest';
281: public const APPLICATION_RPKI_ROA = 'application/rpki-roa';
282: public const APPLICATION_RPKI_UPDOWN = 'application/rpki-updown';
283: public const APPLICATION_RSD_XML = 'application/rsd+xml';
284: public const APPLICATION_RSS_XML = 'application/rss+xml';
285: public const APPLICATION_RTF = 'application/rtf';
286: public const APPLICATION_RTPLOOPBACK = 'application/rtploopback';
287: public const APPLICATION_RTX = 'application/rtx';
288: public const APPLICATION_SAMLASSERTION_XML = 'application/samlassertion+xml';
289: public const APPLICATION_SAMLMETADATA_XML = 'application/samlmetadata+xml';
290: public const APPLICATION_SBML_XML = 'application/sbml+xml';
291: public const APPLICATION_SCAIP_XML = 'application/scaip+xml';
292: public const APPLICATION_SCIM_JSON = 'application/scim+json';
293: public const APPLICATION_SCVP_CV_REQUEST = 'application/scvp-cv-request';
294: public const APPLICATION_SCVP_CV_RESPONSE = 'application/scvp-cv-response';
295: public const APPLICATION_SCVP_VP_REQUEST = 'application/scvp-vp-request';
296: public const APPLICATION_SCVP_VP_RESPONSE = 'application/scvp-vp-response';
297: public const APPLICATION_SDP = 'application/sdp';
298: public const APPLICATION_SEP_EXI = 'application/sep-exi';
299: public const APPLICATION_SEP_XML = 'application/sep+xml';
300: public const APPLICATION_SESSION_INFO = 'application/session-info';
301: public const APPLICATION_SET_PAYMENT = 'application/set-payment';
302: public const APPLICATION_SET_PAYMENT_INITIATION = 'application/set-payment-initiation';
303: public const APPLICATION_SET_REGISTRATION = 'application/set-registration';
304: public const APPLICATION_SET_REGISTRATION_INITIATION = 'application/set-registration-initiation';
305: public const APPLICATION_SGML = 'application/SGML';
306: public const APPLICATION_SGML_OPEN_CATALOG = 'application/sgml-open-catalog';
307: public const APPLICATION_SHF_XML = 'application/shf+xml';
308: public const APPLICATION_SIEVE = 'application/sieve';
309: public const APPLICATION_SIMPLE_FILTER_XML = 'application/simple-filter+xml';
310: public const APPLICATION_SIMPLE_MESSAGE_SUMMARY = 'application/simple-message-summary';
311: public const APPLICATION_SIMPLESYMBOLCONTAINER = 'application/simpleSymbolContainer';
312: public const APPLICATION_SLATE = 'application/slate';
313: public const APPLICATION_SMIL = 'application/smil';
314: public const APPLICATION_SMIL_XML = 'application/smil+xml';
315: public const APPLICATION_SMPTE336M = 'application/smpte336m';
316: public const APPLICATION_SOAP_FASTINFOSET = 'application/soap+fastinfoset';
317: public const APPLICATION_SOAP_XML = 'application/soap+xml';
318: public const APPLICATION_SPARQL_QUERY = 'application/sparql-query';
319: public const APPLICATION_SPARQL_RESULTS_XML = 'application/sparql-results+xml';
320: public const APPLICATION_SPIRITS_EVENT_XML = 'application/spirits-event+xml';
321: public const APPLICATION_SQL = 'application/sql';
322: public const APPLICATION_SRGS = 'application/srgs';
323: public const APPLICATION_SRGS_XML = 'application/srgs+xml';
324: public const APPLICATION_SRU_XML = 'application/sru+xml';
325: public const APPLICATION_SSML_XML = 'application/ssml+xml';
326: public const APPLICATION_TAMP_APEX_UPDATE = 'application/tamp-apex-update';
327: public const APPLICATION_TAMP_APEX_UPDATE_CONFIRM = 'application/tamp-apex-update-confirm';
328: public const APPLICATION_TAMP_COMMUNITY_UPDATE = 'application/tamp-community-update';
329: public const APPLICATION_TAMP_COMMUNITY_UPDATE_CONFIRM = 'application/tamp-community-update-confirm';
330: public const APPLICATION_TAMP_ERROR = 'application/tamp-error';
331: public const APPLICATION_TAMP_SEQUENCE_ADJUST = 'application/tamp-sequence-adjust';
332: public const APPLICATION_TAMP_SEQUENCE_ADJUST_CONFIRM = 'application/tamp-sequence-adjust-confirm';
333: public const APPLICATION_TAMP_STATUS_QUERY = 'application/tamp-status-query';
334: public const APPLICATION_TAMP_STATUS_RESPONSE = 'application/tamp-status-response';
335: public const APPLICATION_TAMP_UPDATE = 'application/tamp-update';
336: public const APPLICATION_TAMP_UPDATE_CONFIRM = 'application/tamp-update-confirm';
337: public const APPLICATION_TEI_XML = 'application/tei+xml';
338: public const APPLICATION_THRAUD_XML = 'application/thraud+xml';
339: public const APPLICATION_TIMESTAMP_QUERY = 'application/timestamp-query';
340: public const APPLICATION_TIMESTAMP_REPLY = 'application/timestamp-reply';
341: public const APPLICATION_TIMESTAMPED_DATA = 'application/timestamped-data';
342: public const APPLICATION_TRIG = 'application/trig';
343: public const APPLICATION_TTML_XML = 'application/ttml+xml';
344: public const APPLICATION_TVE_TRIGGER = 'application/tve-trigger';
345: public const APPLICATION_ULPFEC = 'application/ulpfec';
346: public const APPLICATION_URC_GRPSHEET_XML = 'application/urc-grpsheet+xml';
347: public const APPLICATION_URC_RESSHEET_XML = 'application/urc-ressheet+xml';
348: public const APPLICATION_URC_TARGETDESC_XML = 'application/urc-targetdesc+xml';
349: public const APPLICATION_URC_UISOCKETDESC_XML = 'application/urc-uisocketdesc+xml';
350: public const APPLICATION_VCARD_JSON = 'application/vcard+json';
351: public const APPLICATION_VCARD_XML = 'application/vcard+xml';
352: public const APPLICATION_VEMMI = 'application/vemmi';
353: public const APPLICATION_VND_3GPP2_BCMCSINFO_XML = 'application/vnd.3gpp2.bcmcsinfo+xml';
354: public const APPLICATION_VND_3GPP2_SMS = 'application/vnd.3gpp2.sms';
355: public const APPLICATION_VND_3GPP2_TCAP = 'application/vnd.3gpp2.tcap';
356: public const APPLICATION_VND_3GPP_ACCESS_TRANSFER_EVENTS_XML = 'application/vnd.3gpp.access-transfer-events+xml';
357: public const APPLICATION_VND_3GPP_BSF_XML = 'application/vnd.3gpp.bsf+xml';
358: public const APPLICATION_VND_3GPP_MID_CALL_XML = 'application/vnd.3gpp.mid-call+xml';
359: public const APPLICATION_VND_3GPP_PIC_BW_LARGE = 'application/vnd.3gpp.pic-bw-large';
360: public const APPLICATION_VND_3GPP_PIC_BW_SMALL = 'application/vnd.3gpp.pic-bw-small';
361: public const APPLICATION_VND_3GPP_PIC_BW_VAR = 'application/vnd.3gpp.pic-bw-var';
362: public const APPLICATION_VND_3GPP_PROSE_PC3CH_XML = 'application/vnd.3gpp-prose-pc3ch+xml';
363: public const APPLICATION_VND_3GPP_PROSE_XML = 'application/vnd.3gpp-prose+xml';
364: public const APPLICATION_VND_3GPP_SMS = 'application/vnd.3gpp.sms';
365: public const APPLICATION_VND_3GPP_SMS_XML = 'application/vnd.3gpp.sms+xml';
366: public const APPLICATION_VND_3GPP_SRVCC_EXT_XML = 'application/vnd.3gpp.srvcc-ext+xml';
367: public const APPLICATION_VND_3GPP_SRVCC_INFO_XML = 'application/vnd.3gpp.SRVCC-info+xml';
368: public const APPLICATION_VND_3GPP_STATE_AND_EVENT_INFO_XML = 'application/vnd.3gpp.state-and-event-info+xml';
369: public const APPLICATION_VND_3GPP_USSD_XML = 'application/vnd.3gpp.ussd+xml';
370: public const APPLICATION_VND_3LIGHTSSOFTWARE_IMAGESCAL = 'application/vnd.3lightssoftware.imagescal';
371: public const APPLICATION_VND_3M_POST_IT_NOTES = 'application/vnd.3M.Post-it-Notes';
372: public const APPLICATION_VND_ACCPAC_SIMPLY_ASO = 'application/vnd.accpac.simply.aso';
373: public const APPLICATION_VND_ACCPAC_SIMPLY_IMP = 'application/vnd.accpac.simply.imp';
374: public const APPLICATION_VND_ACUCOBOL = 'application/vnd-acucobol';
375: public const APPLICATION_VND_ACUCORP = 'application/vnd.acucorp';
376: public const APPLICATION_VND_ADOBE_AIR_APPLICATION_INSTALLER_PACKAGE_ZIP = 'application/vnd.adobe.air-application-installer-package+zip';
377: public const APPLICATION_VND_ADOBE_FLASH_MOVIE = 'application/vnd.adobe.flash-movie';
378: public const APPLICATION_VND_ADOBE_FORMSCENTRAL_FCDT = 'application/vnd.adobe.formscentral.fcdt';
379: public const APPLICATION_VND_ADOBE_FXP = 'application/vnd.adobe.fxp';
380: public const APPLICATION_VND_ADOBE_PARTIAL_UPLOAD = 'application/vnd.adobe.partial-upload';
381: public const APPLICATION_VND_ADOBE_XDP_XML = 'application/vnd.adobe.xdp+xml';
382: public const APPLICATION_VND_ADOBE_XFDF = 'application/vnd.adobe.xfdf';
383: public const APPLICATION_VND_AETHER_IMP = 'application/vnd.aether.imp';
384: public const APPLICATION_VND_AH_BARCODE = 'application/vnd.ah-barcode';
385: public const APPLICATION_VND_AHEAD_SPACE = 'application/vnd.ahead.space';
386: public const APPLICATION_VND_AIRZIP_FILESECURE_AZF = 'application/vnd.airzip.filesecure.azf';
387: public const APPLICATION_VND_AIRZIP_FILESECURE_AZS = 'application/vnd.airzip.filesecure.azs';
388: public const APPLICATION_VND_AMAZON_EBOOK = 'application/vnd.amazon.ebook';
389: public const APPLICATION_VND_AMAZON_MOBI8_EBOOK = 'application/vnd.amazon.mobi8-ebook';
390: public const APPLICATION_VND_AMERICANDYNAMICS_ACC = 'application/vnd.americandynamics.acc';
391: public const APPLICATION_VND_AMIGA_AMI = 'application/vnd.amiga.ami';
392: public const APPLICATION_VND_AMUNDSEN_MAZE_XML = 'application/vnd.amundsen.maze+xml';
393: public const APPLICATION_VND_ANDROID_PACKAGE_ARCHIVE = 'application/vnd.android.package-archive';
394: public const APPLICATION_VND_ANKI = 'application/vnd.anki';
395: public const APPLICATION_VND_ANSER_WEB_CERTIFICATE_ISSUE_INITIATION = 'application/vnd.anser-web-certificate-issue-initiation';
396: public const APPLICATION_VND_ANSER_WEB_FUNDS_TRANSFER_INITIATION = 'application/vnd.anser-web-funds-transfer-initiation';
397: public const APPLICATION_VND_ANTIX_GAME_COMPONENT = 'application/vnd.antix.game-component';
398: public const APPLICATION_VND_APACHE_THRIFT_BINARY = 'application/vnd.apache.thrift.binary';
399: public const APPLICATION_VND_APACHE_THRIFT_COMPACT = 'application/vnd.apache.thrift.compact';
400: public const APPLICATION_VND_APACHE_THRIFT_JSON = 'application/vnd.apache.thrift.json';
401: public const APPLICATION_VND_API_JSON = 'application/vnd.api+json';
402: public const APPLICATION_VND_APPLE_INSTALLER_XML = 'application/vnd.apple.installer+xml';
403: public const APPLICATION_VND_APPLE_MPEGURL = 'application/vnd.apple.mpegurl';
404: public const APPLICATION_VND_ARASTRA_SWI = 'application/vnd.arastra.swi';
405: public const APPLICATION_VND_ARISTANETWORKS_SWI = 'application/vnd.aristanetworks.swi';
406: public const APPLICATION_VND_ARTSQUARE = 'application/vnd.artsquare';
407: public const APPLICATION_VND_ASTRAEA_SOFTWARE_IOTA = 'application/vnd.astraea-software.iota';
408: public const APPLICATION_VND_AUDIOGRAPH = 'application/vnd.audiograph';
409: public const APPLICATION_VND_AUTOPACKAGE = 'application/vnd.autopackage';
410: public const APPLICATION_VND_AVISTAR_XML = 'application/vnd.avistar+xml';
411: public const APPLICATION_VND_BALSAMIQ_BMML_XML = 'application/vnd.balsamiq.bmml+xml';
412: public const APPLICATION_VND_BALSAMIQ_BMPR = 'application/vnd.balsamiq.bmpr';
413: public const APPLICATION_VND_BEKITZUR_STECH_JSON = 'application/vnd.bekitzur-stech+json';
414: public const APPLICATION_VND_BIOPAX_RDF_XML = 'application/vnd.biopax.rdf+xml';
415: public const APPLICATION_VND_BLUEICE_MULTIPASS = 'application/vnd.blueice.multipass';
416: public const APPLICATION_VND_BLUETOOTH_EP_OOB = 'application/vnd.bluetooth.ep.oob';
417: public const APPLICATION_VND_BLUETOOTH_LE_OOB = 'application/vnd.bluetooth.le.oob';
418: public const APPLICATION_VND_BMI = 'application/vnd.bmi';
419: public const APPLICATION_VND_BUSINESSOBJECTS = 'application/vnd.businessobjects';
420: public const APPLICATION_VND_CAB_JSCRIPT = 'application/vnd.cab-jscript';
421: public const APPLICATION_VND_CANON_CPDL = 'application/vnd.canon-cpdl';
422: public const APPLICATION_VND_CANON_LIPS = 'application/vnd.canon-lips';
423: public const APPLICATION_VND_CENDIO_THINLINC_CLIENTCONF = 'application/vnd.cendio.thinlinc.clientconf';
424: public const APPLICATION_VND_CENTURY_SYSTEMS_TCP_STREAM = 'application/vnd.century-systems.tcp_stream';
425: public const APPLICATION_VND_CHEMDRAW_XML = 'application/vnd.chemdraw+xml';
426: public const APPLICATION_VND_CHESS_PGN = 'application/vnd.chess-pgn';
427: public const APPLICATION_VND_CHIPNUTS_KARAOKE_MMD = 'application/vnd.chipnuts.karaoke-mmd';
428: public const APPLICATION_VND_CINDERELLA = 'application/vnd.cinderella';
429: public const APPLICATION_VND_CIRPACK_ISDN_EXT = 'application/vnd.cirpack.isdn-ext';
430: public const APPLICATION_VND_CITATIONSTYLES_STYLE_XML = 'application/vnd.citationstyles.style+xml';
431: public const APPLICATION_VND_CLAYMORE = 'application/vnd.claymore';
432: public const APPLICATION_VND_CLOANTO_RP9 = 'application/vnd.cloanto.rp9';
433: public const APPLICATION_VND_CLONK_C4GROUP = 'application/vnd.clonk.c4group';
434: public const APPLICATION_VND_CLUETRUST_CARTOMOBILE_CONFIG = 'application/vnd.cluetrust.cartomobile-config';
435: public const APPLICATION_VND_CLUETRUST_CARTOMOBILE_CONFIG_PKG = 'application/vnd.cluetrust.cartomobile-config-pkg';
436: public const APPLICATION_VND_COFFEESCRIPT = 'application/vnd.coffeescript';
437: public const APPLICATION_VND_COLLECTION_DOC_JSON = 'application/vnd.collection.doc+json';
438: public const APPLICATION_VND_COLLECTION_JSON = 'application/vnd.collection+json';
439: public const APPLICATION_VND_COLLECTION_NEXT_JSON = 'application/vnd.collection.next+json';
440: public const APPLICATION_VND_COMICBOOK_ZIP = 'application/vnd.comicbook+zip';
441: public const APPLICATION_VND_COMMERCE_BATTELLE = 'application/vnd.commerce-battelle';
442: public const APPLICATION_VND_COMMONSPACE = 'application/vnd.commonspace';
443: public const APPLICATION_VND_CONTACT_CMSG = 'application/vnd.contact.cmsg';
444: public const APPLICATION_VND_COREOS_IGNITION_JSON = 'application/vnd.coreos.ignition+json';
445: public const APPLICATION_VND_COSMOCALLER = 'application/vnd.cosmocaller';
446: public const APPLICATION_VND_CRICK_CLICKER = 'application/vnd.crick.clicker';
447: public const APPLICATION_VND_CRICK_CLICKER_KEYBOARD = 'application/vnd.crick.clicker.keyboard';
448: public const APPLICATION_VND_CRICK_CLICKER_PALETTE = 'application/vnd.crick.clicker.palette';
449: public const APPLICATION_VND_CRICK_CLICKER_TEMPLATE = 'application/vnd.crick.clicker.template';
450: public const APPLICATION_VND_CRICK_CLICKER_WORDBANK = 'application/vnd.crick.clicker.wordbank';
451: public const APPLICATION_VND_CRITICALTOOLS_WBS_XML = 'application/vnd.criticaltools.wbs+xml';
452: public const APPLICATION_VND_CTC_POSML = 'application/vnd.ctc-posml';
453: public const APPLICATION_VND_CTCT_WS_XML = 'application/vnd.ctct.ws+xml';
454: public const APPLICATION_VND_CUPS_PDF = 'application/vnd.cups-pdf';
455: public const APPLICATION_VND_CUPS_POSTSCRIPT = 'application/vnd.cups-postscript';
456: public const APPLICATION_VND_CUPS_PPD = 'application/vnd.cups-ppd';
457: public const APPLICATION_VND_CUPS_RASTER = 'application/vnd.cups-raster';
458: public const APPLICATION_VND_CUPS_RAW = 'application/vnd.cups-raw';
459: public const APPLICATION_VND_CURL = 'application/vnd-curl';
460: public const APPLICATION_VND_CURL_CAR = 'application/vnd.curl.car';
461: public const APPLICATION_VND_CURL_PCURL = 'application/vnd.curl.pcurl';
462: public const APPLICATION_VND_CYAN_DEAN_ROOT_XML = 'application/vnd.cyan.dean.root+xml';
463: public const APPLICATION_VND_CYBANK = 'application/vnd.cybank';
464: public const APPLICATION_VND_D2L_COURSEPACKAGE1P0_ZIP = 'application/vnd.d2l.coursepackage1p0+zip';
465: public const APPLICATION_VND_DART = 'application/vnd-dart';
466: public const APPLICATION_VND_DATA_VISION_RDZ = 'application/vnd.data-vision.rdz';
467: public const APPLICATION_VND_DATARESOURCE_JSON = 'application/vnd.dataresource+json';
468: public const APPLICATION_VND_DEBIAN_BINARY_PACKAGE = 'application/vnd.debian.binary-package';
469: public const APPLICATION_VND_DECE_DATA = 'application/vnd.dece.data';
470: public const APPLICATION_VND_DECE_TTML_XML = 'application/vnd.dece.ttml+xml';
471: public const APPLICATION_VND_DECE_UNSPECIFIED = 'application/vnd.dece.unspecified';
472: public const APPLICATION_VND_DECE_ZIP = 'application/vnd.dece-zip';
473: public const APPLICATION_VND_DENOVO_FCSELAYOUT_LINK = 'application/vnd.denovo.fcselayout-link';
474: public const APPLICATION_VND_DESMUME_MOVIE = 'application/vnd.desmume-movie';
475: public const APPLICATION_VND_DIR_BI_PLATE_DL_NOSUFFIX = 'application/vnd.dir-bi.plate-dl-nosuffix';
476: public const APPLICATION_VND_DM_DELEGATION_XML = 'application/vnd.dm.delegation+xml';
477: public const APPLICATION_VND_DNA = 'application/vnd.dna';
478: public const APPLICATION_VND_DOCUMENT_JSON = 'application/vnd.document+json';
479: public const APPLICATION_VND_DOLBY_MLP = 'application/vnd.dolby.mlp';
480: public const APPLICATION_VND_DOLBY_MOBILE_1 = 'application/vnd.dolby.mobile.1';
481: public const APPLICATION_VND_DOLBY_MOBILE_2 = 'application/vnd.dolby.mobile.2';
482: public const APPLICATION_VND_DOREMIR_SCORECLOUD_BINARY_DOCUMENT = 'application/vnd.doremir.scorecloud-binary-document';
483: public const APPLICATION_VND_DPGRAPH = 'application/vnd.dpgraph';
484: public const APPLICATION_VND_DREAMFACTORY = 'application/vnd.dreamfactory';
485: public const APPLICATION_VND_DRIVE_JSON = 'application/vnd.drive+json';
486: public const APPLICATION_VND_DTG_LOCAL = 'application/vnd.dtg.local';
487: public const APPLICATION_VND_DTG_LOCAL_FLASH = 'application/vnd.dtg.local.flash';
488: public const APPLICATION_VND_DTG_LOCAL_HTML = 'application/vnd.dtg.local-html';
489: public const APPLICATION_VND_DVB_AIT = 'application/vnd.dvb.ait';
490: public const APPLICATION_VND_DVB_DVBJ = 'application/vnd.dvb.dvbj';
491: public const APPLICATION_VND_DVB_ESGCONTAINER = 'application/vnd.dvb.esgcontainer';
492: public const APPLICATION_VND_DVB_IPDCDFTNOTIFACCESS = 'application/vnd.dvb.ipdcdftnotifaccess';
493: public const APPLICATION_VND_DVB_IPDCESGACCESS = 'application/vnd.dvb.ipdcesgaccess';
494: public const APPLICATION_VND_DVB_IPDCESGACCESS2 = 'application/vnd.dvb.ipdcesgaccess2';
495: public const APPLICATION_VND_DVB_IPDCESGPDD = 'application/vnd.dvb.ipdcesgpdd';
496: public const APPLICATION_VND_DVB_IPDCROAMING = 'application/vnd.dvb.ipdcroaming';
497: public const APPLICATION_VND_DVB_IPTV_ALFEC_BASE = 'application/vnd.dvb.iptv.alfec-base';
498: public const APPLICATION_VND_DVB_IPTV_ALFEC_ENHANCEMENT = 'application/vnd.dvb.iptv.alfec-enhancement';
499: public const APPLICATION_VND_DVB_NOTIF_AGGREGATE_ROOT_XML = 'application/vnd.dvb.notif-aggregate-root+xml';
500: public const APPLICATION_VND_DVB_NOTIF_CONTAINER_XML = 'application/vnd.dvb.notif-container+xml';
501: public const APPLICATION_VND_DVB_NOTIF_GENERIC_XML = 'application/vnd.dvb.notif-generic+xml';
502: public const APPLICATION_VND_DVB_NOTIF_IA_MSGLIST_XML = 'application/vnd.dvb.notif-ia-msglist+xml';
503: public const APPLICATION_VND_DVB_NOTIF_IA_REGISTRATION_REQUEST_XML = 'application/vnd.dvb.notif-ia-registration-request+xml';
504: public const APPLICATION_VND_DVB_NOTIF_IA_REGISTRATION_RESPONSE_XML = 'application/vnd.dvb.notif-ia-registration-response+xml';
505: public const APPLICATION_VND_DVB_NOTIF_INIT_XML = 'application/vnd.dvb.notif-init+xml';
506: public const APPLICATION_VND_DVB_PFR = 'application/vnd.dvb.pfr';
507: public const APPLICATION_VND_DVB_SERVICE = 'application/vnd.dvb_service';
508: public const APPLICATION_VND_DXR = 'application/vnd-dxr';
509: public const APPLICATION_VND_DYNAGEO = 'application/vnd.dynageo';
510: public const APPLICATION_VND_DZR = 'application/vnd.dzr';
511: public const APPLICATION_VND_EASYKARAOKE_CDGDOWNLOAD = 'application/vnd.easykaraoke.cdgdownload';
512: public const APPLICATION_VND_ECDIS_UPDATE = 'application/vnd.ecdis-update';
513: public const APPLICATION_VND_ECOWIN_CHART = 'application/vnd.ecowin.chart';
514: public const APPLICATION_VND_ECOWIN_FILEREQUEST = 'application/vnd.ecowin.filerequest';
515: public const APPLICATION_VND_ECOWIN_FILEUPDATE = 'application/vnd.ecowin.fileupdate';
516: public const APPLICATION_VND_ECOWIN_SERIES = 'application/vnd.ecowin.series';
517: public const APPLICATION_VND_ECOWIN_SERIESREQUEST = 'application/vnd.ecowin.seriesrequest';
518: public const APPLICATION_VND_ECOWIN_SERIESUPDATE = 'application/vnd.ecowin.seriesupdate';
519: public const APPLICATION_VND_EFI_ISO = 'application/vnd.efi-iso';
520: public const APPLICATION_VND_EMCLIENT_ACCESSREQUEST_XML = 'application/vnd.emclient.accessrequest+xml';
521: public const APPLICATION_VND_ENLIVEN = 'application/vnd.enliven';
522: public const APPLICATION_VND_ENPHASE_ENVOY = 'application/vnd.enphase.envoy';
523: public const APPLICATION_VND_EPRINTS_DATA_XML = 'application/vnd.eprints.data+xml';
524: public const APPLICATION_VND_EPSON_ESF = 'application/vnd.epson.esf';
525: public const APPLICATION_VND_EPSON_MSF = 'application/vnd.epson.msf';
526: public const APPLICATION_VND_EPSON_QUICKANIME = 'application/vnd.epson.quickanime';
527: public const APPLICATION_VND_EPSON_SALT = 'application/vnd.epson.salt';
528: public const APPLICATION_VND_EPSON_SSF = 'application/vnd.epson.ssf';
529: public const APPLICATION_VND_ERICSSON_QUICKCALL = 'application/vnd.ericsson.quickcall';
530: public const APPLICATION_VND_ESPASS_ESPASS_ZIP = 'application/vnd.espass-espass+zip';
531: public const APPLICATION_VND_ESZIGNO3_XML = 'application/vnd.eszigno3+xml';
532: public const APPLICATION_VND_ETSI_AOC_XML = 'application/vnd.etsi.aoc+xml';
533: public const APPLICATION_VND_ETSI_ASIC_E_ZIP = 'application/vnd.etsi.asic-e+zip';
534: public const APPLICATION_VND_ETSI_ASIC_S_ZIP = 'application/vnd.etsi.asic-s+zip';
535: public const APPLICATION_VND_ETSI_CUG_XML = 'application/vnd.etsi.cug+xml';
536: public const APPLICATION_VND_ETSI_IPTVCOMMAND_XML = 'application/vnd.etsi.iptvcommand+xml';
537: public const APPLICATION_VND_ETSI_IPTVDISCOVERY_XML = 'application/vnd.etsi.iptvdiscovery+xml';
538: public const APPLICATION_VND_ETSI_IPTVPROFILE_XML = 'application/vnd.etsi.iptvprofile+xml';
539: public const APPLICATION_VND_ETSI_IPTVSAD_BC_XML = 'application/vnd.etsi.iptvsad-bc+xml';
540: public const APPLICATION_VND_ETSI_IPTVSAD_COD_XML = 'application/vnd.etsi.iptvsad-cod+xml';
541: public const APPLICATION_VND_ETSI_IPTVSAD_NPVR_XML = 'application/vnd.etsi.iptvsad-npvr+xml';
542: public const APPLICATION_VND_ETSI_IPTVSERVICE_XML = 'application/vnd.etsi.iptvservice+xml';
543: public const APPLICATION_VND_ETSI_IPTVSYNC_XML = 'application/vnd.etsi.iptvsync+xml';
544: public const APPLICATION_VND_ETSI_IPTVUEPROFILE_XML = 'application/vnd.etsi.iptvueprofile+xml';
545: public const APPLICATION_VND_ETSI_MCID_XML = 'application/vnd.etsi.mcid+xml';
546: public const APPLICATION_VND_ETSI_MHEG5 = 'application/vnd.etsi.mheg5';
547: public const APPLICATION_VND_ETSI_OVERLOAD_CONTROL_POLICY_DATASET_XML = 'application/vnd.etsi.overload-control-policy-dataset+xml';
548: public const APPLICATION_VND_ETSI_PSTN_XML = 'application/vnd.etsi.pstn+xml';
549: public const APPLICATION_VND_ETSI_SCI_XML = 'application/vnd.etsi.sci+xml';
550: public const APPLICATION_VND_ETSI_SIMSERVS_XML = 'application/vnd.etsi.simservs+xml';
551: public const APPLICATION_VND_ETSI_TIMESTAMP_TOKEN = 'application/vnd.etsi.timestamp-token';
552: public const APPLICATION_VND_ETSI_TSL_DER = 'application/vnd.etsi.tsl.der';
553: public const APPLICATION_VND_ETSI_TSL_XML = 'application/vnd.etsi.tsl+xml';
554: public const APPLICATION_VND_EUDORA_DATA = 'application/vnd.eudora.data';
555: public const APPLICATION_VND_EZPIX_ALBUM = 'application/vnd.ezpix-album';
556: public const APPLICATION_VND_EZPIX_PACKAGE = 'application/vnd.ezpix-package';
557: public const APPLICATION_VND_F_SECURE_MOBILE = 'application/vnd.f-secure.mobile';
558: public const APPLICATION_VND_FASTCOPY_DISK_IMAGE = 'application/vnd.fastcopy-disk-image';
559: public const APPLICATION_VND_FDF = 'application/vnd-fdf';
560: public const APPLICATION_VND_FDSN_MSEED = 'application/vnd.fdsn.mseed';
561: public const APPLICATION_VND_FDSN_SEED = 'application/vnd.fdsn.seed';
562: public const APPLICATION_VND_FFSNS = 'application/vnd.ffsns';
563: public const APPLICATION_VND_FILMIT_ZFC = 'application/vnd.filmit.zfc';
564: public const APPLICATION_VND_FINTS = 'application/vnd.fints';
565: public const APPLICATION_VND_FIREMONKEYS_CLOUDCELL = 'application/vnd.firemonkeys.cloudcell';
566: public const APPLICATION_VND_FLOGRAPHIT = 'application/vnd.FloGraphIt';
567: public const APPLICATION_VND_FLUXTIME_CLIP = 'application/vnd.fluxtime.clip';
568: public const APPLICATION_VND_FONT_FONTFORGE_SFD = 'application/vnd.font-fontforge-sfd';
569: public const APPLICATION_VND_FRAMEMAKER = 'application/vnd.framemaker';
570: public const APPLICATION_VND_FROGANS_FNC = 'application/vnd.frogans.fnc';
571: public const APPLICATION_VND_FROGANS_LTF = 'application/vnd.frogans.ltf';
572: public const APPLICATION_VND_FSC_WEBLAUNCH = 'application/vnd.fsc.weblaunch';
573: public const APPLICATION_VND_FUJITSU_OASYS = 'application/vnd.fujitsu.oasys';
574: public const APPLICATION_VND_FUJITSU_OASYS2 = 'application/vnd.fujitsu.oasys2';
575: public const APPLICATION_VND_FUJITSU_OASYS3 = 'application/vnd.fujitsu.oasys3';
576: public const APPLICATION_VND_FUJITSU_OASYSGP = 'application/vnd.fujitsu.oasysgp';
577: public const APPLICATION_VND_FUJITSU_OASYSPRS = 'application/vnd.fujitsu.oasysprs';
578: public const APPLICATION_VND_FUJIXEROX_ART4 = 'application/vnd.fujixerox.ART4';
579: public const APPLICATION_VND_FUJIXEROX_ART_EX = 'application/vnd.fujixerox.ART-EX';
580: public const APPLICATION_VND_FUJIXEROX_DDD = 'application/vnd.fujixerox.ddd';
581: public const APPLICATION_VND_FUJIXEROX_DOCUWORKS = 'application/vnd.fujixerox.docuworks';
582: public const APPLICATION_VND_FUJIXEROX_DOCUWORKS_BINDER = 'application/vnd.fujixerox.docuworks.binder';
583: public const APPLICATION_VND_FUJIXEROX_DOCUWORKS_CONTAINER = 'application/vnd.fujixerox.docuworks.container';
584: public const APPLICATION_VND_FUJIXEROX_HBPL = 'application/vnd.fujixerox.HBPL';
585: public const APPLICATION_VND_FUT_MISNET = 'application/vnd.fut-misnet';
586: public const APPLICATION_VND_FUZZYSHEET = 'application/vnd.fuzzysheet';
587: public const APPLICATION_VND_GENOMATIX_TUXEDO = 'application/vnd.genomatix.tuxedo';
588: public const APPLICATION_VND_GEO_JSON = 'application/vnd.geo+json';
589: public const APPLICATION_VND_GEOCUBE_XML = 'application/vnd.geocube+xml';
590: public const APPLICATION_VND_GEOGEBRA_FILE = 'application/vnd.geogebra.file';
591: public const APPLICATION_VND_GEOGEBRA_TOOL = 'application/vnd.geogebra.tool';
592: public const APPLICATION_VND_GEOMETRY_EXPLORER = 'application/vnd.geometry-explorer';
593: public const APPLICATION_VND_GEONEXT = 'application/vnd.geonext';
594: public const APPLICATION_VND_GEOPLAN = 'application/vnd.geoplan';
595: public const APPLICATION_VND_GEOSPACE = 'application/vnd.geospace';
596: public const APPLICATION_VND_GERBER = 'application/vnd.gerber';
597: public const APPLICATION_VND_GLOBALPLATFORM_CARD_CONTENT_MGT = 'application/vnd.globalplatform.card-content-mgt';
598: public const APPLICATION_VND_GLOBALPLATFORM_CARD_CONTENT_MGT_RESPONSE = 'application/vnd.globalplatform.card-content-mgt-response';
599: public const APPLICATION_VND_GMX = 'application/vnd.gmx';
600: public const APPLICATION_VND_GOOGLE_EARTH_KML_XML = 'application/vnd.google-earth.kml+xml';
601: public const APPLICATION_VND_GOOGLE_EARTH_KMZ = 'application/vnd.google-earth.kmz';
602: public const APPLICATION_VND_GOV_SK_E_FORM_XML = 'application/vnd.gov.sk.e-form+xml';
603: public const APPLICATION_VND_GOV_SK_E_FORM_ZIP = 'application/vnd.gov.sk.e-form+zip';
604: public const APPLICATION_VND_GOV_SK_XMLDATACONTAINER_XML = 'application/vnd.gov.sk.xmldatacontainer+xml';
605: public const APPLICATION_VND_GRAFEQ = 'application/vnd.grafeq';
606: public const APPLICATION_VND_GRIDMP = 'application/vnd.gridmp';
607: public const APPLICATION_VND_GROOVE_ACCOUNT = 'application/vnd.groove-account';
608: public const APPLICATION_VND_GROOVE_HELP = 'application/vnd.groove-help';
609: public const APPLICATION_VND_GROOVE_IDENTITY_MESSAGE = 'application/vnd.groove-identity-message';
610: public const APPLICATION_VND_GROOVE_INJECTOR = 'application/vnd.groove-injector';
611: public const APPLICATION_VND_GROOVE_TOOL_MESSAGE = 'application/vnd.groove-tool-message';
612: public const APPLICATION_VND_GROOVE_TOOL_TEMPLATE = 'application/vnd.groove-tool-template';
613: public const APPLICATION_VND_GROOVE_VCARD = 'application/vnd.groove-vcard';
614: public const APPLICATION_VND_HAL_JSON = 'application/vnd.hal+json';
615: public const APPLICATION_VND_HAL_XML = 'application/vnd.hal+xml';
616: public const APPLICATION_VND_HANDHELD_ENTERTAINMENT_XML = 'application/vnd.HandHeld-Entertainment+xml';
617: public const APPLICATION_VND_HBCI = 'application/vnd.hbci';
618: public const APPLICATION_VND_HC_JSON = 'application/vnd.hc+json';
619: public const APPLICATION_VND_HCL_BIREPORTS = 'application/vnd.hcl-bireports';
620: public const APPLICATION_VND_HDT = 'application/vnd.hdt';
621: public const APPLICATION_VND_HEROKU_JSON = 'application/vnd.heroku+json';
622: public const APPLICATION_VND_HHE_LESSON_PLAYER = 'application/vnd.hhe.lesson-player';
623: public const APPLICATION_VND_HP_HPGL = 'application/vnd.hp-HPGL';
624: public const APPLICATION_VND_HP_HPID = 'application/vnd.hp-hpid';
625: public const APPLICATION_VND_HP_HPS = 'application/vnd.hp-hps';
626: public const APPLICATION_VND_HP_JLYT = 'application/vnd.hp-jlyt';
627: public const APPLICATION_VND_HP_PCL = 'application/vnd.hp-PCL';
628: public const APPLICATION_VND_HP_PCLXL = 'application/vnd.hp-PCLXL';
629: public const APPLICATION_VND_HTTPHONE = 'application/vnd.httphone';
630: public const APPLICATION_VND_HYDROSTATIX_SOF_DATA = 'application/vnd.hydrostatix.sof-data';
631: public const APPLICATION_VND_HYPERDRIVE_JSON = 'application/vnd.hyperdrive+json';
632: public const APPLICATION_VND_HZN_3D_CROSSWORD = 'application/vnd.hzn-3d-crossword';
633: public const APPLICATION_VND_IBM_AFPLINEDATA = 'application/vnd.ibm.afplinedata';
634: public const APPLICATION_VND_IBM_ELECTRONIC_MEDIA = 'application/vnd.ibm.electronic-media';
635: public const APPLICATION_VND_IBM_MINIPAY = 'application/vnd.ibm.MiniPay';
636: public const APPLICATION_VND_IBM_MODCAP = 'application/vnd.ibm.modcap';
637: public const APPLICATION_VND_IBM_RIGHTS_MANAGEMENT = 'application/vnd.ibm.rights-management';
638: public const APPLICATION_VND_IBM_SECURE_CONTAINER = 'application/vnd.ibm.secure-container';
639: public const APPLICATION_VND_ICCPROFILE = 'application/vnd.iccprofile';
640: public const APPLICATION_VND_IEEE_1905 = 'application/vnd.ieee.1905';
641: public const APPLICATION_VND_IGLOADER = 'application/vnd.igloader';
642: public const APPLICATION_VND_IMMERVISION_IVP = 'application/vnd.immervision-ivp';
643: public const APPLICATION_VND_IMMERVISION_IVU = 'application/vnd.immervision-ivu';
644: public const APPLICATION_VND_IMS_IMSCCV1P1 = 'application/vnd.ims.imsccv1p1';
645: public const APPLICATION_VND_IMS_IMSCCV1P2 = 'application/vnd.ims.imsccv1p2';
646: public const APPLICATION_VND_IMS_IMSCCV1P3 = 'application/vnd.ims.imsccv1p3';
647: public const APPLICATION_VND_IMS_LIS_V2_RESULT_JSON = 'application/vnd.ims.lis.v2.result+json';
648: public const APPLICATION_VND_IMS_LTI_V2_TOOLCONSUMERPROFILE_JSON = 'application/vnd.ims.lti.v2.toolconsumerprofile+json';
649: public const APPLICATION_VND_IMS_LTI_V2_TOOLPROXY_ID_JSON = 'application/vnd.ims.lti.v2.toolproxy.id+json';
650: public const APPLICATION_VND_IMS_LTI_V2_TOOLPROXY_JSON = 'application/vnd.ims.lti.v2.toolproxy+json';
651: public const APPLICATION_VND_IMS_LTI_V2_TOOLSETTINGS_JSON = 'application/vnd.ims.lti.v2.toolsettings+json';
652: public const APPLICATION_VND_IMS_LTI_V2_TOOLSETTINGS_SIMPLE_JSON = 'application/vnd.ims.lti.v2.toolsettings.simple+json';
653: public const APPLICATION_VND_INFORMEDCONTROL_RMS_XML = 'application/vnd.informedcontrol.rms+xml';
654: public const APPLICATION_VND_INFORMIX_VISIONARY = 'application/vnd.informix-visionary';
655: public const APPLICATION_VND_INFOTECH_PROJECT = 'application/vnd.infotech.project';
656: public const APPLICATION_VND_INFOTECH_PROJECT_XML = 'application/vnd.infotech.project+xml';
657: public const APPLICATION_VND_INNOPATH_WAMP_NOTIFICATION = 'application/vnd.innopath.wamp.notification';
658: public const APPLICATION_VND_INSORS_IGM = 'application/vnd.insors.igm';
659: public const APPLICATION_VND_INTERCON_FORMNET = 'application/vnd.intercon.formnet';
660: public const APPLICATION_VND_INTERGEO = 'application/vnd.intergeo';
661: public const APPLICATION_VND_INTERTRUST_DIGIBOX = 'application/vnd.intertrust.digibox';
662: public const APPLICATION_VND_INTERTRUST_NNCP = 'application/vnd.intertrust.nncp';
663: public const APPLICATION_VND_INTU_QBO = 'application/vnd.intu.qbo';
664: public const APPLICATION_VND_INTU_QFX = 'application/vnd.intu.qfx';
665: public const APPLICATION_VND_IPTC_G2_CATALOGITEM_XML = 'application/vnd.iptc.g2.catalogitem+xml';
666: public const APPLICATION_VND_IPTC_G2_CONCEPTITEM_XML = 'application/vnd.iptc.g2.conceptitem+xml';
667: public const APPLICATION_VND_IPTC_G2_KNOWLEDGEITEM_XML = 'application/vnd.iptc.g2.knowledgeitem+xml';
668: public const APPLICATION_VND_IPTC_G2_NEWSITEM_XML = 'application/vnd.iptc.g2.newsitem+xml';
669: public const APPLICATION_VND_IPTC_G2_NEWSMESSAGE_XML = 'application/vnd.iptc.g2.newsmessage+xml';
670: public const APPLICATION_VND_IPTC_G2_PACKAGEITEM_XML = 'application/vnd.iptc.g2.packageitem+xml';
671: public const APPLICATION_VND_IPTC_G2_PLANNINGITEM_XML = 'application/vnd.iptc.g2.planningitem+xml';
672: public const APPLICATION_VND_IPUNPLUGGED_RCPROFILE = 'application/vnd.ipunplugged.rcprofile';
673: public const APPLICATION_VND_IREPOSITORY_PACKAGE_XML = 'application/vnd.irepository.package+xml';
674: public const APPLICATION_VND_IS_XPR = 'application/vnd.is-xpr';
675: public const APPLICATION_VND_ISAC_FCS = 'application/vnd.isac.fcs';
676: public const APPLICATION_VND_JAM = 'application/vnd.jam';
677: public const APPLICATION_VND_JAPANNET_DIRECTORY_SERVICE = 'application/vnd.japannet-directory-service';
678: public const APPLICATION_VND_JAPANNET_JPNSTORE_WAKEUP = 'application/vnd.japannet-jpnstore-wakeup';
679: public const APPLICATION_VND_JAPANNET_PAYMENT_WAKEUP = 'application/vnd.japannet-payment-wakeup';
680: public const APPLICATION_VND_JAPANNET_REGISTRATION = 'application/vnd.japannet-registration';
681: public const APPLICATION_VND_JAPANNET_REGISTRATION_WAKEUP = 'application/vnd.japannet-registration-wakeup';
682: public const APPLICATION_VND_JAPANNET_SETSTORE_WAKEUP = 'application/vnd.japannet-setstore-wakeup';
683: public const APPLICATION_VND_JAPANNET_VERIFICATION = 'application/vnd.japannet-verification';
684: public const APPLICATION_VND_JAPANNET_VERIFICATION_WAKEUP = 'application/vnd.japannet-verification-wakeup';
685: public const APPLICATION_VND_JCP_JAVAME_MIDLET_RMS = 'application/vnd.jcp.javame.midlet-rms';
686: public const APPLICATION_VND_JISP = 'application/vnd.jisp';
687: public const APPLICATION_VND_JOOST_JODA_ARCHIVE = 'application/vnd.joost.joda-archive';
688: public const APPLICATION_VND_JSK_ISDN_NGN = 'application/vnd.jsk.isdn-ngn';
689: public const APPLICATION_VND_KAHOOTZ = 'application/vnd.kahootz';
690: public const APPLICATION_VND_KDE_KARBON = 'application/vnd.kde.karbon';
691: public const APPLICATION_VND_KDE_KCHART = 'application/vnd.kde.kchart';
692: public const APPLICATION_VND_KDE_KFORMULA = 'application/vnd.kde.kformula';
693: public const APPLICATION_VND_KDE_KIVIO = 'application/vnd.kde.kivio';
694: public const APPLICATION_VND_KDE_KONTOUR = 'application/vnd.kde.kontour';
695: public const APPLICATION_VND_KDE_KPRESENTER = 'application/vnd.kde.kpresenter';
696: public const APPLICATION_VND_KDE_KSPREAD = 'application/vnd.kde.kspread';
697: public const APPLICATION_VND_KDE_KWORD = 'application/vnd.kde.kword';
698: public const APPLICATION_VND_KENAMEAAPP = 'application/vnd.kenameaapp';
699: public const APPLICATION_VND_KIDSPIRATION = 'application/vnd.kidspiration';
700: public const APPLICATION_VND_KINAR = 'application/vnd.Kinar';
701: public const APPLICATION_VND_KOAN = 'application/vnd.koan';
702: public const APPLICATION_VND_KODAK_DESCRIPTOR = 'application/vnd.kodak-descriptor';
703: public const APPLICATION_VND_LAS_LAS_XML = 'application/vnd.las.las+xml';
704: public const APPLICATION_VND_LIBERTY_REQUEST_XML = 'application/vnd.liberty-request+xml';
705: public const APPLICATION_VND_LLAMAGRAPHICS_LIFE_BALANCE_DESKTOP = 'application/vnd.llamagraphics.life-balance.desktop';
706: public const APPLICATION_VND_LLAMAGRAPHICS_LIFE_BALANCE_EXCHANGE_XML = 'application/vnd.llamagraphics.life-balance.exchange+xml';
707: public const APPLICATION_VND_LOTUS_1_2_3 = 'application/vnd.lotus-1-2-3';
708: public const APPLICATION_VND_LOTUS_APPROACH = 'application/vnd.lotus-approach';
709: public const APPLICATION_VND_LOTUS_FREELANCE = 'application/vnd.lotus-freelance';
710: public const APPLICATION_VND_LOTUS_NOTES = 'application/vnd.lotus-notes';
711: public const APPLICATION_VND_LOTUS_ORGANIZER = 'application/vnd.lotus-organizer';
712: public const APPLICATION_VND_LOTUS_SCREENCAM = 'application/vnd.lotus-screencam';
713: public const APPLICATION_VND_LOTUS_WORDPRO = 'application/vnd.lotus-wordpro';
714: public const APPLICATION_VND_MACPORTS_PORTPKG = 'application/vnd.macports.portpkg';
715: public const APPLICATION_VND_MAPBOX_VECTOR_TILE = 'application/vnd.mapbox-vector-tile';
716: public const APPLICATION_VND_MARLIN_DRM_ACTIONTOKEN_XML = 'application/vnd.marlin.drm.actiontoken+xml';
717: public const APPLICATION_VND_MARLIN_DRM_CONFTOKEN_XML = 'application/vnd.marlin.drm.conftoken+xml';
718: public const APPLICATION_VND_MARLIN_DRM_LICENSE_XML = 'application/vnd.marlin.drm.license+xml';
719: public const APPLICATION_VND_MARLIN_DRM_MDCF = 'application/vnd.marlin.drm.mdcf';
720: public const APPLICATION_VND_MASON_JSON = 'application/vnd.mason+json';
721: public const APPLICATION_VND_MAXMIND_MAXMIND_DB = 'application/vnd.maxmind.maxmind-db';
722: public const APPLICATION_VND_MCD = 'application/vnd.mcd';
723: public const APPLICATION_VND_MEDCALCDATA = 'application/vnd.medcalcdata';
724: public const APPLICATION_VND_MEDIASTATION_CDKEY = 'application/vnd.mediastation.cdkey';
725: public const APPLICATION_VND_MERIDIAN_SLINGSHOT = 'application/vnd.meridian-slingshot';
726: public const APPLICATION_VND_MFER = 'application/vnd.MFER';
727: public const APPLICATION_VND_MFMP = 'application/vnd.mfmp';
728: public const APPLICATION_VND_MICRO_JSON = 'application/vnd.micro+json';
729: public const APPLICATION_VND_MICROGRAFX_FLO = 'application/vnd.micrografx.flo';
730: public const APPLICATION_VND_MICROGRAFX_IGX = 'application/vnd.micrografx-igx';
731: public const APPLICATION_VND_MICROSOFT_PORTABLE_EXECUTABLE = 'application/vnd.microsoft.portable-executable';
732: public const APPLICATION_VND_MIELE_JSON = 'application/vnd.miele+json';
733: public const APPLICATION_VND_MIF = 'application/vnd-mif';
734: public const APPLICATION_VND_MINISOFT_HP3000_SAVE = 'application/vnd.minisoft-hp3000-save';
735: public const APPLICATION_VND_MITSUBISHI_MISTY_GUARD_TRUSTWEB = 'application/vnd.mitsubishi.misty-guard.trustweb';
736: public const APPLICATION_VND_MOBIUS_DAF = 'application/vnd.Mobius.DAF';
737: public const APPLICATION_VND_MOBIUS_DIS = 'application/vnd.Mobius.DIS';
738: public const APPLICATION_VND_MOBIUS_MBK = 'application/vnd.Mobius.MBK';
739: public const APPLICATION_VND_MOBIUS_MQY = 'application/vnd.Mobius.MQY';
740: public const APPLICATION_VND_MOBIUS_MSL = 'application/vnd.Mobius.MSL';
741: public const APPLICATION_VND_MOBIUS_PLC = 'application/vnd.Mobius.PLC';
742: public const APPLICATION_VND_MOBIUS_TXF = 'application/vnd.Mobius.TXF';
743: public const APPLICATION_VND_MOPHUN_APPLICATION = 'application/vnd.mophun.application';
744: public const APPLICATION_VND_MOPHUN_CERTIFICATE = 'application/vnd.mophun.certificate';
745: public const APPLICATION_VND_MOTOROLA_FLEXSUITE = 'application/vnd.motorola.flexsuite';
746: public const APPLICATION_VND_MOTOROLA_FLEXSUITE_ADSI = 'application/vnd.motorola.flexsuite.adsi';
747: public const APPLICATION_VND_MOTOROLA_FLEXSUITE_FIS = 'application/vnd.motorola.flexsuite.fis';
748: public const APPLICATION_VND_MOTOROLA_FLEXSUITE_GOTAP = 'application/vnd.motorola.flexsuite.gotap';
749: public const APPLICATION_VND_MOTOROLA_FLEXSUITE_KMR = 'application/vnd.motorola.flexsuite.kmr';
750: public const APPLICATION_VND_MOTOROLA_FLEXSUITE_TTC = 'application/vnd.motorola.flexsuite.ttc';
751: public const APPLICATION_VND_MOTOROLA_FLEXSUITE_WEM = 'application/vnd.motorola.flexsuite.wem';
752: public const APPLICATION_VND_MOTOROLA_IPRM = 'application/vnd.motorola.iprm';
753: public const APPLICATION_VND_MOZILLA_XUL_XML = 'application/vnd.mozilla.xul+xml';
754: public const APPLICATION_VND_MS_3MFDOCUMENT = 'application/vnd.ms-3mfdocument';
755: public const APPLICATION_VND_MS_ARTGALRY = 'application/vnd.ms-artgalry';
756: public const APPLICATION_VND_MS_ASF = 'application/vnd.ms-asf';
757: public const APPLICATION_VND_MS_CAB_COMPRESSED = 'application/vnd.ms-cab-compressed';
758: public const APPLICATION_VND_MS_EXCEL = 'application/vnd.ms-excel';
759: public const APPLICATION_VND_MS_EXCEL_ADDIN_MACROENABLED_12 = 'application/vnd.ms-excel.addin.macroEnabled.12';
760: public const APPLICATION_VND_MS_EXCEL_SHEET_BINARY_MACROENABLED_12 = 'application/vnd.ms-excel.sheet.binary.macroEnabled.12';
761: public const APPLICATION_VND_MS_EXCEL_SHEET_MACROENABLED_12 = 'application/vnd.ms-excel.sheet.macroEnabled.12';
762: public const APPLICATION_VND_MS_EXCEL_TEMPLATE_MACROENABLED_12 = 'application/vnd.ms-excel.template.macroEnabled.12';
763: public const APPLICATION_VND_MS_FONTOBJECT = 'application/vnd.ms-fontobject';
764: public const APPLICATION_VND_MS_HTMLHELP = 'application/vnd.ms-htmlhelp';
765: public const APPLICATION_VND_MS_IMS = 'application/vnd.ms-ims';
766: public const APPLICATION_VND_MS_LRM = 'application/vnd.ms-lrm';
767: public const APPLICATION_VND_MS_OFFICE_ACTIVEX_XML = 'application/vnd.ms-office.activeX+xml';
768: public const APPLICATION_VND_MS_OFFICETHEME = 'application/vnd.ms-officetheme';
769: public const APPLICATION_VND_MS_PKI_SECCAT = 'application/vnd.ms-pki.seccat';
770: public const APPLICATION_VND_MS_PKI_STL = 'application/vnd.ms-pki.stl';
771: public const APPLICATION_VND_MS_PLAYREADY_INITIATOR_XML = 'application/vnd.ms-playready.initiator+xml';
772: public const APPLICATION_VND_MS_POWERPOINT = 'application/vnd.ms-powerpoint';
773: public const APPLICATION_VND_MS_POWERPOINT_ADDIN_MACROENABLED_12 = 'application/vnd.ms-powerpoint.addin.macroEnabled.12';
774: public const APPLICATION_VND_MS_POWERPOINT_PRESENTATION_MACROENABLED_12 = 'application/vnd.ms-powerpoint.presentation.macroEnabled.12';
775: public const APPLICATION_VND_MS_POWERPOINT_SLIDE_MACROENABLED_12 = 'application/vnd.ms-powerpoint.slide.macroEnabled.12';
776: public const APPLICATION_VND_MS_POWERPOINT_SLIDESHOW_MACROENABLED_12 = 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12';
777: public const APPLICATION_VND_MS_POWERPOINT_TEMPLATE_MACROENABLED_12 = 'application/vnd.ms-powerpoint.template.macroEnabled.12';
778: public const APPLICATION_VND_MS_PRINTDEVICECAPABILITIES_XML = 'application/vnd.ms-PrintDeviceCapabilities+xml';
779: public const APPLICATION_VND_MS_PRINTSCHEMATICKET_XML = 'application/vnd.ms-PrintSchemaTicket+xml';
780: public const APPLICATION_VND_MS_PROJECT = 'application/vnd.ms-project';
781: public const APPLICATION_VND_MS_TNEF = 'application/vnd.ms-tnef';
782: public const APPLICATION_VND_MS_WINDOWS_DEVICEPAIRING = 'application/vnd.ms-windows.devicepairing';
783: public const APPLICATION_VND_MS_WINDOWS_NWPRINTING_OOB = 'application/vnd.ms-windows.nwprinting.oob';
784: public const APPLICATION_VND_MS_WINDOWS_PRINTERPAIRING = 'application/vnd.ms-windows.printerpairing';
785: public const APPLICATION_VND_MS_WINDOWS_WSD_OOB = 'application/vnd.ms-windows.wsd.oob';
786: public const APPLICATION_VND_MS_WMDRM_LIC_CHLG_REQ = 'application/vnd.ms-wmdrm.lic-chlg-req';
787: public const APPLICATION_VND_MS_WMDRM_LIC_RESP = 'application/vnd.ms-wmdrm.lic-resp';
788: public const APPLICATION_VND_MS_WMDRM_METER_CHLG_REQ = 'application/vnd.ms-wmdrm.meter-chlg-req';
789: public const APPLICATION_VND_MS_WMDRM_METER_RESP = 'application/vnd.ms-wmdrm.meter-resp';
790: public const APPLICATION_VND_MS_WORD_DOCUMENT_MACROENABLED_12 = 'application/vnd.ms-word.document.macroEnabled.12';
791: public const APPLICATION_VND_MS_WORD_TEMPLATE_MACROENABLED_12 = 'application/vnd.ms-word.template.macroEnabled.12';
792: public const APPLICATION_VND_MS_WORKS = 'application/vnd.ms-works';
793: public const APPLICATION_VND_MS_WPL = 'application/vnd.ms-wpl';
794: public const APPLICATION_VND_MS_XPSDOCUMENT = 'application/vnd.ms-xpsdocument';
795: public const APPLICATION_VND_MSA_DISK_IMAGE = 'application/vnd.msa-disk-image';
796: public const APPLICATION_VND_MSEQ = 'application/vnd.mseq';
797: public const APPLICATION_VND_MSIGN = 'application/vnd.msign';
798: public const APPLICATION_VND_MULTIAD_CREATOR = 'application/vnd.multiad.creator';
799: public const APPLICATION_VND_MULTIAD_CREATOR_CIF = 'application/vnd.multiad.creator.cif';
800: public const APPLICATION_VND_MUSIC_NIFF = 'application/vnd.music-niff';
801: public const APPLICATION_VND_MUSICIAN = 'application/vnd.musician';
802: public const APPLICATION_VND_MUVEE_STYLE = 'application/vnd.muvee.style';
803: public const APPLICATION_VND_MYNFC = 'application/vnd.mynfc';
804: public const APPLICATION_VND_NCD_CONTROL = 'application/vnd.ncd.control';
805: public const APPLICATION_VND_NCD_REFERENCE = 'application/vnd.ncd.reference';
806: public const APPLICATION_VND_NEARST_INV_JSON = 'application/vnd.nearst.inv+json';
807: public const APPLICATION_VND_NERVANA = 'application/vnd.nervana';
808: public const APPLICATION_VND_NETFPX = 'application/vnd.netfpx';
809: public const APPLICATION_VND_NEUROLANGUAGE_NLU = 'application/vnd.neurolanguage.nlu';
810: public const APPLICATION_VND_NINTENDO_NITRO_ROM = 'application/vnd.nintendo.nitro.rom';
811: public const APPLICATION_VND_NINTENDO_SNES_ROM = 'application/vnd.nintendo.snes.rom';
812: public const APPLICATION_VND_NITF = 'application/vnd.nitf';
813: public const APPLICATION_VND_NOBLENET_DIRECTORY = 'application/vnd.noblenet-directory';
814: public const APPLICATION_VND_NOBLENET_SEALER = 'application/vnd.noblenet-sealer';
815: public const APPLICATION_VND_NOBLENET_WEB = 'application/vnd.noblenet-web';
816: public const APPLICATION_VND_NOKIA_CATALOGS = 'application/vnd.nokia.catalogs';
817: public const APPLICATION_VND_NOKIA_CONML_WBXML = 'application/vnd.nokia.conml+wbxml';
818: public const APPLICATION_VND_NOKIA_CONML_XML = 'application/vnd.nokia.conml+xml';
819: public const APPLICATION_VND_NOKIA_IPTV_CONFIG_XML = 'application/vnd.nokia.iptv.config+xml';
820: public const APPLICATION_VND_NOKIA_ISDS_RADIO_PRESETS = 'application/vnd.nokia.iSDS-radio-presets';
821: public const APPLICATION_VND_NOKIA_LANDMARK_WBXML = 'application/vnd.nokia.landmark+wbxml';
822: public const APPLICATION_VND_NOKIA_LANDMARK_XML = 'application/vnd.nokia.landmark+xml';
823: public const APPLICATION_VND_NOKIA_LANDMARKCOLLECTION_XML = 'application/vnd.nokia.landmarkcollection+xml';
824: public const APPLICATION_VND_NOKIA_N_GAGE_AC_XML = 'application/vnd.nokia.n-gage.ac+xml';
825: public const APPLICATION_VND_NOKIA_N_GAGE_DATA = 'application/vnd.nokia.n-gage.data';
826: public const APPLICATION_VND_NOKIA_N_GAGE_SYMBIAN_INSTALL = 'application/vnd.nokia.n-gage.symbian.install';
827: public const APPLICATION_VND_NOKIA_NCD = 'application/vnd.nokia.ncd';
828: public const APPLICATION_VND_NOKIA_PCD_WBXML = 'application/vnd.nokia.pcd+wbxml';
829: public const APPLICATION_VND_NOKIA_PCD_XML = 'application/vnd.nokia.pcd+xml';
830: public const APPLICATION_VND_NOKIA_RADIO_PRESET = 'application/vnd.nokia.radio-preset';
831: public const APPLICATION_VND_NOKIA_RADIO_PRESETS = 'application/vnd.nokia.radio-presets';
832: public const APPLICATION_VND_NOVADIGM_EDM = 'application/vnd.novadigm.EDM';
833: public const APPLICATION_VND_NOVADIGM_EDX = 'application/vnd.novadigm.EDX';
834: public const APPLICATION_VND_NOVADIGM_EXT = 'application/vnd.novadigm.EXT';
835: public const APPLICATION_VND_NTT_LOCAL_CONTENT_SHARE = 'application/vnd.ntt-local.content-share';
836: public const APPLICATION_VND_NTT_LOCAL_FILE_TRANSFER = 'application/vnd.ntt-local.file-transfer';
837: public const APPLICATION_VND_NTT_LOCAL_OGW_REMOTE_ACCESS = 'application/vnd.ntt-local.ogw_remote-access';
838: public const APPLICATION_VND_NTT_LOCAL_SIP_TA_REMOTE = 'application/vnd.ntt-local.sip-ta_remote';
839: public const APPLICATION_VND_NTT_LOCAL_SIP_TA_TCP_STREAM = 'application/vnd.ntt-local.sip-ta_tcp_stream';
840: public const APPLICATION_VND_OASIS_OPENDOCUMENT_CHART = 'application/vnd.oasis.opendocument.chart';
841: public const APPLICATION_VND_OASIS_OPENDOCUMENT_CHART_TEMPLATE = 'application/vnd.oasis.opendocument.chart-template';
842: public const APPLICATION_VND_OASIS_OPENDOCUMENT_DATABASE = 'application/vnd.oasis.opendocument.database';
843: public const APPLICATION_VND_OASIS_OPENDOCUMENT_FORMULA = 'application/vnd.oasis.opendocument.formula';
844: public const APPLICATION_VND_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE = 'application/vnd.oasis.opendocument.formula-template';
845: public const APPLICATION_VND_OASIS_OPENDOCUMENT_GRAPHICS = 'application/vnd.oasis.opendocument.graphics';
846: public const APPLICATION_VND_OASIS_OPENDOCUMENT_GRAPHICS_TEMPLATE = 'application/vnd.oasis.opendocument.graphics-template';
847: public const APPLICATION_VND_OASIS_OPENDOCUMENT_IMAGE = 'application/vnd.oasis.opendocument.image';
848: public const APPLICATION_VND_OASIS_OPENDOCUMENT_IMAGE_TEMPLATE = 'application/vnd.oasis.opendocument.image-template';
849: public const APPLICATION_VND_OASIS_OPENDOCUMENT_PRESENTATION = 'application/vnd.oasis.opendocument.presentation';
850: public const APPLICATION_VND_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE = 'application/vnd.oasis.opendocument.presentation-template';
851: public const APPLICATION_VND_OASIS_OPENDOCUMENT_SPREADSHEET = 'application/vnd.oasis.opendocument.spreadsheet';
852: public const APPLICATION_VND_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE = 'application/vnd.oasis.opendocument.spreadsheet-template';
853: public const APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT = 'application/vnd.oasis.opendocument.text';
854: public const APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT_MASTER = 'application/vnd.oasis.opendocument.text-master';
855: public const APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT_TEMPLATE = 'application/vnd.oasis.opendocument.text-template';
856: public const APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT_WEB = 'application/vnd.oasis.opendocument.text-web';
857: public const APPLICATION_VND_OBN = 'application/vnd.obn';
858: public const APPLICATION_VND_OFTN_L10N_JSON = 'application/vnd.oftn.l10n+json';
859: public const APPLICATION_VND_OIPF_CONTENTACCESSDOWNLOAD_XML = 'application/vnd.oipf.contentaccessdownload+xml';
860: public const APPLICATION_VND_OIPF_CONTENTACCESSSTREAMING_XML = 'application/vnd.oipf.contentaccessstreaming+xml';
861: public const APPLICATION_VND_OIPF_CSPG_HEXBINARY = 'application/vnd.oipf.cspg-hexbinary';
862: public const APPLICATION_VND_OIPF_DAE_SVG_XML = 'application/vnd.oipf.dae.svg+xml';
863: public const APPLICATION_VND_OIPF_DAE_XHTML_XML = 'application/vnd.oipf.dae.xhtml+xml';
864: public const APPLICATION_VND_OIPF_MIPPVCONTROLMESSAGE_XML = 'application/vnd.oipf.mippvcontrolmessage+xml';
865: public const APPLICATION_VND_OIPF_PAE_GEM = 'application/vnd.oipf.pae.gem';
866: public const APPLICATION_VND_OIPF_SPDISCOVERY_XML = 'application/vnd.oipf.spdiscovery+xml';
867: public const APPLICATION_VND_OIPF_SPDLIST_XML = 'application/vnd.oipf.spdlist+xml';
868: public const APPLICATION_VND_OIPF_UEPROFILE_XML = 'application/vnd.oipf.ueprofile+xml';
869: public const APPLICATION_VND_OIPF_USERPROFILE_XML = 'application/vnd.oipf.userprofile+xml';
870: public const APPLICATION_VND_OLPC_SUGAR = 'application/vnd.olpc-sugar';
871: public const APPLICATION_VND_OMA_BCAST_ASSOCIATED_PROCEDURE_PARAMETER_XML = 'application/vnd.oma.bcast.associated-procedure-parameter+xml';
872: public const APPLICATION_VND_OMA_BCAST_DRM_TRIGGER_XML = 'application/vnd.oma.bcast.drm-trigger+xml';
873: public const APPLICATION_VND_OMA_BCAST_IMD_XML = 'application/vnd.oma.bcast.imd+xml';
874: public const APPLICATION_VND_OMA_BCAST_LTKM = 'application/vnd.oma.bcast.ltkm';
875: public const APPLICATION_VND_OMA_BCAST_NOTIFICATION_XML = 'application/vnd.oma.bcast.notification+xml';
876: public const APPLICATION_VND_OMA_BCAST_PROVISIONINGTRIGGER = 'application/vnd.oma.bcast.provisioningtrigger';
877: public const APPLICATION_VND_OMA_BCAST_SGBOOT = 'application/vnd.oma.bcast.sgboot';
878: public const APPLICATION_VND_OMA_BCAST_SGDD_XML = 'application/vnd.oma.bcast.sgdd+xml';
879: public const APPLICATION_VND_OMA_BCAST_SGDU = 'application/vnd.oma.bcast.sgdu';
880: public const APPLICATION_VND_OMA_BCAST_SIMPLE_SYMBOL_CONTAINER = 'application/vnd.oma.bcast.simple-symbol-container';
881: public const APPLICATION_VND_OMA_BCAST_SMARTCARD_TRIGGER_XML = 'application/vnd.oma.bcast.smartcard-trigger+xml';
882: public const APPLICATION_VND_OMA_BCAST_SPROV_XML = 'application/vnd.oma.bcast.sprov+xml';
883: public const APPLICATION_VND_OMA_BCAST_STKM = 'application/vnd.oma.bcast.stkm';
884: public const APPLICATION_VND_OMA_CAB_ADDRESS_BOOK_XML = 'application/vnd.oma.cab-address-book+xml';
885: public const APPLICATION_VND_OMA_CAB_FEATURE_HANDLER_XML = 'application/vnd.oma.cab-feature-handler+xml';
886: public const APPLICATION_VND_OMA_CAB_PCC_XML = 'application/vnd.oma.cab-pcc+xml';
887: public const APPLICATION_VND_OMA_CAB_SUBS_INVITE_XML = 'application/vnd.oma.cab-subs-invite+xml';
888: public const APPLICATION_VND_OMA_CAB_USER_PREFS_XML = 'application/vnd.oma.cab-user-prefs+xml';
889: public const APPLICATION_VND_OMA_DCD = 'application/vnd.oma.dcd';
890: public const APPLICATION_VND_OMA_DCDC = 'application/vnd.oma.dcdc';
891: public const APPLICATION_VND_OMA_DD2_XML = 'application/vnd.oma.dd2+xml';
892: public const APPLICATION_VND_OMA_DRM_RISD_XML = 'application/vnd.oma.drm.risd+xml';
893: public const APPLICATION_VND_OMA_GROUP_USAGE_LIST_XML = 'application/vnd.oma.group-usage-list+xml';
894: public const APPLICATION_VND_OMA_LWM2M_JSON = 'application/vnd.oma.lwm2m+json';
895: public const APPLICATION_VND_OMA_LWM2M_TLV = 'application/vnd.oma.lwm2m+tlv';
896: public const APPLICATION_VND_OMA_PAL_XML = 'application/vnd.oma.pal+xml';
897: public const APPLICATION_VND_OMA_POC_DETAILED_PROGRESS_REPORT_XML = 'application/vnd.oma.poc.detailed-progress-report+xml';
898: public const APPLICATION_VND_OMA_POC_FINAL_REPORT_XML = 'application/vnd.oma.poc.final-report+xml';
899: public const APPLICATION_VND_OMA_POC_GROUPS_XML = 'application/vnd.oma.poc.groups+xml';
900: public const APPLICATION_VND_OMA_POC_INVOCATION_DESCRIPTOR_XML = 'application/vnd.oma.poc.invocation-descriptor+xml';
901: public const APPLICATION_VND_OMA_POC_OPTIMIZED_PROGRESS_REPORT_XML = 'application/vnd.oma.poc.optimized-progress-report+xml';
902: public const APPLICATION_VND_OMA_PUSH = 'application/vnd.oma.push';
903: public const APPLICATION_VND_OMA_SCIDM_MESSAGES_XML = 'application/vnd.oma.scidm.messages+xml';
904: public const APPLICATION_VND_OMA_SCWS_CONFIG = 'application/vnd.oma-scws-config';
905: public const APPLICATION_VND_OMA_SCWS_HTTP_REQUEST = 'application/vnd.oma-scws-http-request';
906: public const APPLICATION_VND_OMA_SCWS_HTTP_RESPONSE = 'application/vnd.oma-scws-http-response';
907: public const APPLICATION_VND_OMA_XCAP_DIRECTORY_XML = 'application/vnd.oma.xcap-directory+xml';
908: public const APPLICATION_VND_OMADS_EMAIL_XML = 'application/vnd.omads-email+xml';
909: public const APPLICATION_VND_OMADS_FILE_XML = 'application/vnd.omads-file+xml';
910: public const APPLICATION_VND_OMADS_FOLDER_XML = 'application/vnd.omads-folder+xml';
911: public const APPLICATION_VND_OMALOC_SUPL_INIT = 'application/vnd.omaloc-supl-init';
912: public const APPLICATION_VND_ONEPAGER = 'application/vnd.onepager';
913: public const APPLICATION_VND_OPENBLOX_GAME_BINARY = 'application/vnd.openblox.game-binary';
914: public const APPLICATION_VND_OPENBLOX_GAME_XML = 'application/vnd.openblox.game+xml';
915: public const APPLICATION_VND_OPENEYE_OEB = 'application/vnd.openeye.oeb';
916: public const APPLICATION_VND_OPENOFFICEORG_EXTENSION = 'application/vnd.openofficeorg.extension';
917: public const APPLICATION_VND_OPENSTREETMAP_DATA_XML = 'application/vnd.openstreetmap.data+xml';
918: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_CUSTOM_PROPERTIES_XML = 'application/vnd.openxmlformats-officedocument.custom-properties+xml';
919: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_CUSTOMXMLPROPERTIES_XML = 'application/vnd.openxmlformats-officedocument.customXmlProperties+xml';
920: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_DRAWING_XML = 'application/vnd.openxmlformats-officedocument.drawing+xml';
921: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_DRAWINGML_CHART_XML = 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml';
922: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_DRAWINGML_CHARTSHAPES_XML = 'application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml';
923: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_DRAWINGML_DIAGRAMCOLORS_XML = 'application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml';
924: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_DRAWINGML_DIAGRAMDATA_XML = 'application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml';
925: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_DRAWINGML_DIAGRAMLAYOUT_XML = 'application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml';
926: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_DRAWINGML_DIAGRAMSTYLE_XML = 'application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml';
927: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_EXTENDED_PROPERTIES_XML = 'application/vnd.openxmlformats-officedocument.extended-properties+xml';
928: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_COMMENTAUTHORS_XML = 'application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml';
929: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_COMMENTS_XML = 'application/vnd.openxmlformats-officedocument.presentationml.comments+xml';
930: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_HANDOUTMASTER_XML = 'application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml';
931: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_NOTESMASTER_XML = 'application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml';
932: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_NOTESSLIDE_XML = 'application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml';
933: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_PRESENTATION = 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
934: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_PRESENTATION_MAIN_XML = 'application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml';
935: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_PRESPROPS_XML = 'application/vnd.openxmlformats-officedocument.presentationml.presProps+xml';
936: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_SLIDE = 'application/vnd.openxmlformats-officedocument.presentationml.slide';
937: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_SLIDE_XML = 'application/vnd.openxmlformats-officedocument.presentationml.slide+xml';
938: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_SLIDELAYOUT_XML = 'application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml';
939: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_SLIDEMASTER_XML = 'application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml';
940: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_SLIDESHOW = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow';
941: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_SLIDESHOW_MAIN_XML = 'application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml';
942: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_SLIDEUPDATEINFO_XML = 'application/vnd.openxmlformats-officedocument.presentationml.slideUpdateInfo+xml';
943: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_TABLESTYLES_XML = 'application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml';
944: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_TAGS_XML = 'application/vnd.openxmlformats-officedocument.presentationml.tags+xml';
945: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_TEMPLATE = 'application/vnd.openxmlformats-officedocument.presentationml-template';
946: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_TEMPLATE_MAIN_XML = 'application/vnd.openxmlformats-officedocument.presentationml.template.main+xml';
947: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_VIEWPROPS_XML = 'application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml';
948: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_CALCCHAIN_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml';
949: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_CHARTSHEET_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml';
950: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_COMMENTS_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml';
951: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_CONNECTIONS_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml';
952: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_DIALOGSHEET_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml';
953: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_EXTERNALLINK_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml';
954: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_PIVOTCACHEDEFINITION_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml';
955: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_PIVOTCACHERECORDS_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml';
956: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_PIVOTTABLE_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml';
957: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_QUERYTABLE_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml';
958: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_REVISIONHEADERS_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml';
959: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_REVISIONLOG_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml';
960: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHAREDSTRINGS_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml';
961: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
962: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET_MAIN_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml';
963: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEETMETADATA_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml';
964: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_STYLES_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml';
965: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_TABLE_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml';
966: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_TABLESINGLECELLS_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml';
967: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_TEMPLATE = 'application/vnd.openxmlformats-officedocument.spreadsheetml-template';
968: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_TEMPLATE_MAIN_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml';
969: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_USERNAMES_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml';
970: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_VOLATILEDEPENDENCIES_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.volatileDependencies+xml';
971: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_WORKSHEET_XML = 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml';
972: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_THEME_XML = 'application/vnd.openxmlformats-officedocument.theme+xml';
973: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_THEMEOVERRIDE_XML = 'application/vnd.openxmlformats-officedocument.themeOverride+xml';
974: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_VMLDRAWING = 'application/vnd.openxmlformats-officedocument.vmlDrawing';
975: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_COMMENTS_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml';
976: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
977: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT_GLOSSARY_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml';
978: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT_MAIN_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml';
979: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_ENDNOTES_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml';
980: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_FONTTABLE_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml';
981: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_FOOTER_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml';
982: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_FOOTNOTES_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml';
983: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_NUMBERING_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml';
984: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_SETTINGS_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml';
985: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_STYLES_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml';
986: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_TEMPLATE = 'application/vnd.openxmlformats-officedocument.wordprocessingml-template';
987: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_TEMPLATE_MAIN_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml';
988: public const APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_WEBSETTINGS_XML = 'application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml';
989: public const APPLICATION_VND_OPENXMLFORMATS_PACKAGE_CORE_PROPERTIES_XML = 'application/vnd.openxmlformats-package.core-properties+xml';
990: public const APPLICATION_VND_OPENXMLFORMATS_PACKAGE_DIGITAL_SIGNATURE_XMLSIGNATURE_XML = 'application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml';
991: public const APPLICATION_VND_OPENXMLFORMATS_PACKAGE_RELATIONSHIPS_XML = 'application/vnd.openxmlformats-package.relationships+xml';
992: public const APPLICATION_VND_ORACLE_RESOURCE_JSON = 'application/vnd.oracle.resource+json';
993: public const APPLICATION_VND_ORANGE_INDATA = 'application/vnd.orange.indata';
994: public const APPLICATION_VND_OSA_NETDEPLOY = 'application/vnd.osa.netdeploy';
995: public const APPLICATION_VND_OSGEO_MAPGUIDE_PACKAGE = 'application/vnd.osgeo.mapguide.package';
996: public const APPLICATION_VND_OSGI_BUNDLE = 'application/vnd.osgi.bundle';
997: public const APPLICATION_VND_OSGI_DP = 'application/vnd.osgi.dp';
998: public const APPLICATION_VND_OSGI_SUBSYSTEM = 'application/vnd.osgi.subsystem';
999: public const APPLICATION_VND_OTPS_CT_KIP_XML = 'application/vnd.otps.ct-kip+xml';
1000: public const APPLICATION_VND_OXLI_COUNTGRAPH = 'application/vnd.oxli.countgraph';
1001: public const APPLICATION_VND_PAGERDUTY_JSON = 'application/vnd.pagerduty+json';
1002: public const APPLICATION_VND_PALM = 'application/vnd.palm';
1003: public const APPLICATION_VND_PANOPLY = 'application/vnd.panoply';
1004: public const APPLICATION_VND_PAOS_XML = 'application/vnd.paos+xml';
1005: public const APPLICATION_VND_PAWAAFILE = 'application/vnd.pawaafile';
1006: public const APPLICATION_VND_PCOS = 'application/vnd.pcos';
1007: public const APPLICATION_VND_PG_FORMAT = 'application/vnd.pg.format';
1008: public const APPLICATION_VND_PG_OSASLI = 'application/vnd.pg.osasli';
1009: public const APPLICATION_VND_PIACCESS_APPLICATION_LICENCE = 'application/vnd.piaccess.application-licence';
1010: public const APPLICATION_VND_PICSEL = 'application/vnd.picsel';
1011: public const APPLICATION_VND_PMI_WIDGET = 'application/vnd.pmi.widget';
1012: public const APPLICATION_VND_POC_GROUP_ADVERTISEMENT_XML = 'application/vnd.poc.group-advertisement+xml';
1013: public const APPLICATION_VND_POCKETLEARN = 'application/vnd.pocketlearn';
1014: public const APPLICATION_VND_POWERBUILDER6 = 'application/vnd.powerbuilder6';
1015: public const APPLICATION_VND_POWERBUILDER6_S = 'application/vnd.powerbuilder6-s';
1016: public const APPLICATION_VND_POWERBUILDER7 = 'application/vnd.powerbuilder7';
1017: public const APPLICATION_VND_POWERBUILDER75 = 'application/vnd.powerbuilder75';
1018: public const APPLICATION_VND_POWERBUILDER75_S = 'application/vnd.powerbuilder75-s';
1019: public const APPLICATION_VND_POWERBUILDER7_S = 'application/vnd.powerbuilder7-s';
1020: public const APPLICATION_VND_PREMINET = 'application/vnd.preminet';
1021: public const APPLICATION_VND_PREVIEWSYSTEMS_BOX = 'application/vnd.previewsystems.box';
1022: public const APPLICATION_VND_PROTEUS_MAGAZINE = 'application/vnd.proteus.magazine';
1023: public const APPLICATION_VND_PUBLISHARE_DELTA_TREE = 'application/vnd.publishare-delta-tree';
1024: public const APPLICATION_VND_PVI_PTID1 = 'application/vnd.pvi.ptid1';
1025: public const APPLICATION_VND_PWG_MULTIPLEXED = 'application/vnd.pwg-multiplexed';
1026: public const APPLICATION_VND_PWG_XHTML_PRINT_XML = 'application/vnd.pwg-xhtml-print+xml';
1027: public const APPLICATION_VND_QUALCOMM_BREW_APP_RES = 'application/vnd.qualcomm.brew-app-res';
1028: public const APPLICATION_VND_QUARANTAINENET = 'application/vnd.quarantainenet';
1029: public const APPLICATION_VND_QUARK_QUARKXPRESS = 'application/vnd.Quark.QuarkXPress';
1030: public const APPLICATION_VND_QUOBJECT_QUOXDOCUMENT = 'application/vnd.quobject-quoxdocument';
1031: public const APPLICATION_VND_RADISYS_MOML_XML = 'application/vnd.radisys.moml+xml';
1032: public const APPLICATION_VND_RADISYS_MSML_AUDIT_CONF_XML = 'application/vnd.radisys.msml-audit-conf+xml';
1033: public const APPLICATION_VND_RADISYS_MSML_AUDIT_CONN_XML = 'application/vnd.radisys.msml-audit-conn+xml';
1034: public const APPLICATION_VND_RADISYS_MSML_AUDIT_DIALOG_XML = 'application/vnd.radisys.msml-audit-dialog+xml';
1035: public const APPLICATION_VND_RADISYS_MSML_AUDIT_STREAM_XML = 'application/vnd.radisys.msml-audit-stream+xml';
1036: public const APPLICATION_VND_RADISYS_MSML_AUDIT_XML = 'application/vnd.radisys.msml-audit+xml';
1037: public const APPLICATION_VND_RADISYS_MSML_CONF_XML = 'application/vnd.radisys.msml-conf+xml';
1038: public const APPLICATION_VND_RADISYS_MSML_DIALOG_BASE_XML = 'application/vnd.radisys.msml-dialog-base+xml';
1039: public const APPLICATION_VND_RADISYS_MSML_DIALOG_FAX_DETECT_XML = 'application/vnd.radisys.msml-dialog-fax-detect+xml';
1040: public const APPLICATION_VND_RADISYS_MSML_DIALOG_FAX_SENDRECV_XML = 'application/vnd.radisys.msml-dialog-fax-sendrecv+xml';
1041: public const APPLICATION_VND_RADISYS_MSML_DIALOG_GROUP_XML = 'application/vnd.radisys.msml-dialog-group+xml';
1042: public const APPLICATION_VND_RADISYS_MSML_DIALOG_SPEECH_XML = 'application/vnd.radisys.msml-dialog-speech+xml';
1043: public const APPLICATION_VND_RADISYS_MSML_DIALOG_TRANSFORM_XML = 'application/vnd.radisys.msml-dialog-transform+xml';
1044: public const APPLICATION_VND_RADISYS_MSML_DIALOG_XML = 'application/vnd.radisys.msml-dialog+xml';
1045: public const APPLICATION_VND_RADISYS_MSML_XML = 'application/vnd.radisys.msml+xml';
1046: public const APPLICATION_VND_RAINSTOR_DATA = 'application/vnd.rainstor.data';
1047: public const APPLICATION_VND_RAPID = 'application/vnd.rapid';
1048: public const APPLICATION_VND_RAR = 'application/vnd.rar';
1049: public const APPLICATION_VND_REALVNC_BED = 'application/vnd.realvnc.bed';
1050: public const APPLICATION_VND_RECORDARE_MUSICXML = 'application/vnd.recordare.musicxml';
1051: public const APPLICATION_VND_RECORDARE_MUSICXML_XML = 'application/vnd.recordare.musicxml+xml';
1052: public const APPLICATION_VND_RENLEARN_RLPRINT = 'application/vnd.renlearn.rlprint';
1053: public const APPLICATION_VND_RIG_CRYPTONOTE = 'application/vnd.rig.cryptonote';
1054: public const APPLICATION_VND_RIM_COD = 'application/vnd.rim.cod';
1055: public const APPLICATION_VND_RN_REALMEDIA = 'application/vnd.rn-realmedia';
1056: public const APPLICATION_VND_ROUTE66_LINK66_XML = 'application/vnd.route66.link66+xml';
1057: public const APPLICATION_VND_RS_274X = 'application/vnd.rs-274x';
1058: public const APPLICATION_VND_RUCKUS_DOWNLOAD = 'application/vnd.ruckus.download';
1059: public const APPLICATION_VND_S3SMS = 'application/vnd.s3sms';
1060: public const APPLICATION_VND_SAILINGTRACKER_TRACK = 'application/vnd.sailingtracker.track';
1061: public const APPLICATION_VND_SBM_CID = 'application/vnd.sbm.cid';
1062: public const APPLICATION_VND_SBM_MID2 = 'application/vnd.sbm.mid2';
1063: public const APPLICATION_VND_SCRIBUS = 'application/vnd.scribus';
1064: public const APPLICATION_VND_SEALED_3DF = 'application/vnd.sealed.3df';
1065: public const APPLICATION_VND_SEALED_CSF = 'application/vnd.sealed.csf';
1066: public const APPLICATION_VND_SEALED_DOC = 'application/vnd.sealed-doc';
1067: public const APPLICATION_VND_SEALED_EML = 'application/vnd.sealed-eml';
1068: public const APPLICATION_VND_SEALED_MHT = 'application/vnd.sealed-mht';
1069: public const APPLICATION_VND_SEALED_NET = 'application/vnd.sealed.net';
1070: public const APPLICATION_VND_SEALED_PPT = 'application/vnd.sealed-ppt';
1071: public const APPLICATION_VND_SEALED_TIFF = 'application/vnd.sealed-tiff';
1072: public const APPLICATION_VND_SEALED_XLS = 'application/vnd.sealed-xls';
1073: public const APPLICATION_VND_SEALEDMEDIA_SOFTSEAL_HTML = 'application/vnd.sealedmedia.softseal-html';
1074: public const APPLICATION_VND_SEALEDMEDIA_SOFTSEAL_PDF = 'application/vnd.sealedmedia.softseal-pdf';
1075: public const APPLICATION_VND_SEEMAIL = 'application/vnd.seemail';
1076: public const APPLICATION_VND_SEMA = 'application/vnd-sema';
1077: public const APPLICATION_VND_SEMD = 'application/vnd.semd';
1078: public const APPLICATION_VND_SEMF = 'application/vnd.semf';
1079: public const APPLICATION_VND_SHANA_INFORMED_FORMDATA = 'application/vnd.shana.informed.formdata';
1080: public const APPLICATION_VND_SHANA_INFORMED_FORMTEMPLATE = 'application/vnd.shana.informed.formtemplate';
1081: public const APPLICATION_VND_SHANA_INFORMED_INTERCHANGE = 'application/vnd.shana.informed.interchange';
1082: public const APPLICATION_VND_SHANA_INFORMED_PACKAGE = 'application/vnd.shana.informed.package';
1083: public const APPLICATION_VND_SIMTECH_MINDMAPPER = 'application/vnd.SimTech-MindMapper';
1084: public const APPLICATION_VND_SIREN_JSON = 'application/vnd.siren+json';
1085: public const APPLICATION_VND_SMAF = 'application/vnd.smaf';
1086: public const APPLICATION_VND_SMART_NOTEBOOK = 'application/vnd.smart.notebook';
1087: public const APPLICATION_VND_SMART_TEACHER = 'application/vnd.smart.teacher';
1088: public const APPLICATION_VND_SOFTWARE602_FILLER_FORM_XML = 'application/vnd.software602.filler.form+xml';
1089: public const APPLICATION_VND_SOFTWARE602_FILLER_FORM_XML_ZIP = 'application/vnd.software602.filler.form-xml-zip';
1090: public const APPLICATION_VND_SOLENT_SDKM_XML = 'application/vnd.solent.sdkm+xml';
1091: public const APPLICATION_VND_SPOTFIRE_DXP = 'application/vnd.spotfire.dxp';
1092: public const APPLICATION_VND_SPOTFIRE_SFS = 'application/vnd.spotfire.sfs';
1093: public const APPLICATION_VND_SSS_COD = 'application/vnd.sss-cod';
1094: public const APPLICATION_VND_SSS_DTF = 'application/vnd.sss-dtf';
1095: public const APPLICATION_VND_SSS_NTF = 'application/vnd.sss-ntf';
1096: public const APPLICATION_VND_STARDIVISION_CALC = 'application/vnd.stardivision.calc';
1097: public const APPLICATION_VND_STARDIVISION_DRAW = 'application/vnd.stardivision.draw';
1098: public const APPLICATION_VND_STARDIVISION_IMPRESS = 'application/vnd.stardivision.impress';
1099: public const APPLICATION_VND_STARDIVISION_MATH = 'application/vnd.stardivision.math';
1100: public const APPLICATION_VND_STARDIVISION_WRITER = 'application/vnd.stardivision.writer';
1101: public const APPLICATION_VND_STARDIVISION_WRITER_GLOBAL = 'application/vnd.stardivision.writer-global';
1102: public const APPLICATION_VND_STEPMANIA_PACKAGE = 'application/vnd.stepmania.package';
1103: public const APPLICATION_VND_STEPMANIA_STEPCHART = 'application/vnd.stepmania.stepchart';
1104: public const APPLICATION_VND_STREET_STREAM = 'application/vnd.street-stream';
1105: public const APPLICATION_VND_SUN_WADL_XML = 'application/vnd.sun.wadl+xml';
1106: public const APPLICATION_VND_SUN_XML_CALC = 'application/vnd.sun.xml.calc';
1107: public const APPLICATION_VND_SUN_XML_CALC_TEMPLATE = 'application/vnd.sun.xml.calc.template';
1108: public const APPLICATION_VND_SUN_XML_DRAW = 'application/vnd.sun.xml.draw';
1109: public const APPLICATION_VND_SUN_XML_DRAW_TEMPLATE = 'application/vnd.sun.xml.draw.template';
1110: public const APPLICATION_VND_SUN_XML_IMPRESS = 'application/vnd.sun.xml.impress';
1111: public const APPLICATION_VND_SUN_XML_IMPRESS_TEMPLATE = 'application/vnd.sun.xml.impress.template';
1112: public const APPLICATION_VND_SUN_XML_MATH = 'application/vnd.sun.xml.math';
1113: public const APPLICATION_VND_SUN_XML_WRITER = 'application/vnd.sun.xml.writer';
1114: public const APPLICATION_VND_SUN_XML_WRITER_GLOBAL = 'application/vnd.sun.xml.writer.global';
1115: public const APPLICATION_VND_SUN_XML_WRITER_TEMPLATE = 'application/vnd.sun.xml.writer.template';
1116: public const APPLICATION_VND_SUS_CALENDAR = 'application/vnd.sus-calendar';
1117: public const APPLICATION_VND_SVD = 'application/vnd.svd';
1118: public const APPLICATION_VND_SWIFTVIEW_ICS = 'application/vnd.swiftview-ics';
1119: public const APPLICATION_VND_SYMBIAN_INSTALL = 'application/vnd.symbian.install';
1120: public const APPLICATION_VND_SYNCML_DM_NOTIFICATION = 'application/vnd.syncml.dm.notification';
1121: public const APPLICATION_VND_SYNCML_DM_WBXML = 'application/vnd.syncml.dm+wbxml';
1122: public const APPLICATION_VND_SYNCML_DM_XML = 'application/vnd.syncml.dm+xml';
1123: public const APPLICATION_VND_SYNCML_DMDDF_WBXML = 'application/vnd.syncml.dmddf+wbxml';
1124: public const APPLICATION_VND_SYNCML_DMDDF_XML = 'application/vnd.syncml.dmddf+xml';
1125: public const APPLICATION_VND_SYNCML_DMTNDS_WBXML = 'application/vnd.syncml.dmtnds+wbxml';
1126: public const APPLICATION_VND_SYNCML_DMTNDS_XML = 'application/vnd.syncml.dmtnds+xml';
1127: public const APPLICATION_VND_SYNCML_DS_NOTIFICATION = 'application/vnd.syncml.ds.notification';
1128: public const APPLICATION_VND_SYNCML_XML = 'application/vnd.syncml+xml';
1129: public const APPLICATION_VND_TABLESCHEMA_JSON = 'application/vnd.tableschema+json';
1130: public const APPLICATION_VND_TAO_INTENT_MODULE_ARCHIVE = 'application/vnd.tao.intent-module-archive';
1131: public const APPLICATION_VND_TCPDUMP_PCAP = 'application/vnd.tcpdump.pcap';
1132: public const APPLICATION_VND_TMD_MEDIAFLEX_API_XML = 'application/vnd.tmd.mediaflex.api+xml';
1133: public const APPLICATION_VND_TML = 'application/vnd.tml';
1134: public const APPLICATION_VND_TMOBILE_LIVETV = 'application/vnd.tmobile-livetv';
1135: public const APPLICATION_VND_TRI_ONESOURCE = 'application/vnd.tri.onesource';
1136: public const APPLICATION_VND_TRID_TPT = 'application/vnd.trid.tpt';
1137: public const APPLICATION_VND_TRISCAPE_MXS = 'application/vnd.triscape.mxs';
1138: public const APPLICATION_VND_TRUEAPP = 'application/vnd.trueapp';
1139: public const APPLICATION_VND_TRUEDOC = 'application/vnd.truedoc';
1140: public const APPLICATION_VND_UBISOFT_WEBPLAYER = 'application/vnd.ubisoft.webplayer';
1141: public const APPLICATION_VND_UFDL = 'application/vnd.ufdl';
1142: public const APPLICATION_VND_UIQ_THEME = 'application/vnd.uiq.theme';
1143: public const APPLICATION_VND_UMAJIN = 'application/vnd.umajin';
1144: public const APPLICATION_VND_UNITY = 'application/vnd.unity';
1145: public const APPLICATION_VND_UOML_XML = 'application/vnd.uoml+xml';
1146: public const APPLICATION_VND_UPLANET_ALERT = 'application/vnd.uplanet.alert';
1147: public const APPLICATION_VND_UPLANET_ALERT_WBXML = 'application/vnd.uplanet.alert-wbxml';
1148: public const APPLICATION_VND_UPLANET_BEARER_CHOICE = 'application/vnd.uplanet.bearer-choice';
1149: public const APPLICATION_VND_UPLANET_BEARER_CHOICE_WBXML = 'application/vnd.uplanet.bearer-choice-wbxml';
1150: public const APPLICATION_VND_UPLANET_CACHEOP = 'application/vnd.uplanet.cacheop';
1151: public const APPLICATION_VND_UPLANET_CACHEOP_WBXML = 'application/vnd.uplanet.cacheop-wbxml';
1152: public const APPLICATION_VND_UPLANET_CHANNEL = 'application/vnd.uplanet.channel';
1153: public const APPLICATION_VND_UPLANET_CHANNEL_WBXML = 'application/vnd.uplanet.channel-wbxml';
1154: public const APPLICATION_VND_UPLANET_LIST = 'application/vnd.uplanet.list';
1155: public const APPLICATION_VND_UPLANET_LIST_WBXML = 'application/vnd.uplanet.list-wbxml';
1156: public const APPLICATION_VND_UPLANET_LISTCMD = 'application/vnd.uplanet.listcmd';
1157: public const APPLICATION_VND_UPLANET_LISTCMD_WBXML = 'application/vnd.uplanet.listcmd-wbxml';
1158: public const APPLICATION_VND_UPLANET_SIGNAL = 'application/vnd.uplanet.signal';
1159: public const APPLICATION_VND_URI_MAP = 'application/vnd.uri-map';
1160: public const APPLICATION_VND_VALVE_SOURCE_MATERIAL = 'application/vnd.valve.source.material';
1161: public const APPLICATION_VND_VCX = 'application/vnd.vcx';
1162: public const APPLICATION_VND_VD_STUDY = 'application/vnd.vd-study';
1163: public const APPLICATION_VND_VECTORWORKS = 'application/vnd.vectorworks';
1164: public const APPLICATION_VND_VEL_JSON = 'application/vnd.vel+json';
1165: public const APPLICATION_VND_VERIMATRIX_VCAS = 'application/vnd.verimatrix.vcas';
1166: public const APPLICATION_VND_VIDSOFT_VIDCONFERENCE = 'application/vnd.vidsoft.vidconference';
1167: public const APPLICATION_VND_VISIO = 'application/vnd.visio';
1168: public const APPLICATION_VND_VISIO2013 = 'application/vnd.visio2013';
1169: public const APPLICATION_VND_VISIONARY = 'application/vnd.visionary';
1170: public const APPLICATION_VND_VIVIDENCE_SCRIPTFILE = 'application/vnd.vividence.scriptfile';
1171: public const APPLICATION_VND_VSF = 'application/vnd.vsf';
1172: public const APPLICATION_VND_WAP_SIC = 'application/vnd.wap.sic';
1173: public const APPLICATION_VND_WAP_SLC = 'application/vnd.wap-slc';
1174: public const APPLICATION_VND_WAP_WBXML = 'application/vnd.wap-wbxml';
1175: public const APPLICATION_VND_WAP_WMLC = 'application/vnd-wap-wmlc';
1176: public const APPLICATION_VND_WAP_WMLSCRIPTC = 'application/vnd.wap.wmlscriptc';
1177: public const APPLICATION_VND_WEBTURBO = 'application/vnd.webturbo';
1178: public const APPLICATION_VND_WFA_P2P = 'application/vnd.wfa.p2p';
1179: public const APPLICATION_VND_WFA_WSC = 'application/vnd.wfa.wsc';
1180: public const APPLICATION_VND_WINDOWS_DEVICEPAIRING = 'application/vnd.windows.devicepairing';
1181: public const APPLICATION_VND_WMC = 'application/vnd.wmc';
1182: public const APPLICATION_VND_WMF_BOOTSTRAP = 'application/vnd.wmf.bootstrap';
1183: public const APPLICATION_VND_WOLFRAM_MATHEMATICA = 'application/vnd.wolfram.mathematica';
1184: public const APPLICATION_VND_WOLFRAM_MATHEMATICA_PACKAGE = 'application/vnd.wolfram.mathematica.package';
1185: public const APPLICATION_VND_WOLFRAM_PLAYER = 'application/vnd.wolfram.player';
1186: public const APPLICATION_VND_WORDPERFECT = 'application/vnd.wordperfect';
1187: public const APPLICATION_VND_WQD = 'application/vnd.wqd';
1188: public const APPLICATION_VND_WRQ_HP3000_LABELLED = 'application/vnd.wrq-hp3000-labelled';
1189: public const APPLICATION_VND_WT_STF = 'application/vnd.wt.stf';
1190: public const APPLICATION_VND_WV_CSP_WBXML = 'application/vnd.wv.csp+wbxml';
1191: public const APPLICATION_VND_WV_CSP_XML = 'application/vnd.wv.csp+xml';
1192: public const APPLICATION_VND_WV_SSP_XML = 'application/vnd.wv.ssp+xml';
1193: public const APPLICATION_VND_XACML_JSON = 'application/vnd.xacml+json';
1194: public const APPLICATION_VND_XARA = 'application/vnd.xara';
1195: public const APPLICATION_VND_XFDL = 'application/vnd.xfdl';
1196: public const APPLICATION_VND_XFDL_WEBFORM = 'application/vnd.xfdl.webform';
1197: public const APPLICATION_VND_XMI_XML = 'application/vnd.xmi+xml';
1198: public const APPLICATION_VND_XMPIE_CPKG = 'application/vnd.xmpie.cpkg';
1199: public const APPLICATION_VND_XMPIE_DPKG = 'application/vnd.xmpie.dpkg';
1200: public const APPLICATION_VND_XMPIE_PLAN = 'application/vnd.xmpie.plan';
1201: public const APPLICATION_VND_XMPIE_PPKG = 'application/vnd.xmpie.ppkg';
1202: public const APPLICATION_VND_XMPIE_XLIM = 'application/vnd.xmpie.xlim';
1203: public const APPLICATION_VND_YAMAHA_HV_DIC = 'application/vnd.yamaha.hv-dic';
1204: public const APPLICATION_VND_YAMAHA_HV_SCRIPT = 'application/vnd.yamaha.hv-script';
1205: public const APPLICATION_VND_YAMAHA_HV_VOICE = 'application/vnd.yamaha.hv-voice';
1206: public const APPLICATION_VND_YAMAHA_OPENSCOREFORMAT = 'application/vnd.yamaha.openscoreformat';
1207: public const APPLICATION_VND_YAMAHA_OPENSCOREFORMAT_OSFPVG_XML = 'application/vnd.yamaha.openscoreformat.osfpvg+xml';
1208: public const APPLICATION_VND_YAMAHA_REMOTE_SETUP = 'application/vnd.yamaha.remote-setup';
1209: public const APPLICATION_VND_YAMAHA_SMAF_AUDIO = 'application/vnd.yamaha.smaf-audio';
1210: public const APPLICATION_VND_YAMAHA_SMAF_PHRASE = 'application/vnd.yamaha.smaf-phrase';
1211: public const APPLICATION_VND_YAMAHA_THROUGH_NGN = 'application/vnd.yamaha.through-ngn';
1212: public const APPLICATION_VND_YAMAHA_TUNNEL_UDPENCAP = 'application/vnd.yamaha.tunnel-udpencap';
1213: public const APPLICATION_VND_YAOWEME = 'application/vnd.yaoweme';
1214: public const APPLICATION_VND_YELLOWRIVER_CUSTOM_MENU = 'application/vnd.yellowriver-custom-menu';
1215: public const APPLICATION_VND_ZUL = 'application/vnd.zul';
1216: public const APPLICATION_VND_ZZAZZ_DECK_XML = 'application/vnd.zzazz.deck+xml';
1217: public const APPLICATION_VOICEXML_XML = 'application/voicexml+xml';
1218: public const APPLICATION_VQ_RTCPXR = 'application/vq-rtcpxr';
1219: public const APPLICATION_WATCHERINFO_XML = 'application/watcherinfo+xml';
1220: public const APPLICATION_WHOISPP_QUERY = 'application/whoispp-query';
1221: public const APPLICATION_WHOISPP_RESPONSE = 'application/whoispp-response';
1222: public const APPLICATION_WIDGET = 'application/widget';
1223: public const APPLICATION_WINHLP = 'application/winhlp';
1224: public const APPLICATION_WITA = 'application/wita';
1225: public const APPLICATION_WORDPERFECT5_1 = 'application/wordperfect5.1';
1226: public const APPLICATION_WSDL_XML = 'application/wsdl+xml';
1227: public const APPLICATION_WSPOLICY_XML = 'application/wspolicy+xml';
1228: public const APPLICATION_X400_BP = 'application/x400-bp';
1229: public const APPLICATION_X_7Z_COMPRESSED = 'application/x-7z-compressed';
1230: public const APPLICATION_X_ABIWORD = 'application/x-abiword';
1231: public const APPLICATION_X_ACE_COMPRESSED = 'application/x-ace-compressed';
1232: public const APPLICATION_X_ALZ_COMPRESSED = 'application/x-alz-compressed';
1233: public const APPLICATION_X_APPLE_DISKIMAGE = 'application/x-apple-diskimage';
1234: public const APPLICATION_X_ARJ = 'application/x-arj';
1235: public const APPLICATION_X_ASTROTITE_AFA = 'application/x-astrotite-afa';
1236: public const APPLICATION_X_AUTHORWARE_BIN = 'application/x-authorware-bin';
1237: public const APPLICATION_X_AUTHORWARE_MAP = 'application/x-authorware-map';
1238: public const APPLICATION_X_AUTHORWARE_SEG = 'application/x-authorware-seg';
1239: public const APPLICATION_X_B1 = 'application/x-b1';
1240: public const APPLICATION_X_BCPIO = 'application/x-bcpio';
1241: public const APPLICATION_X_BITTORRENT = 'application/x-bittorrent';
1242: public const APPLICATION_X_BZIP = 'application/x-bzip';
1243: public const APPLICATION_X_BZIP2 = 'application/x-bzip2';
1244: public const APPLICATION_X_CDLINK = 'application/x-cdlink';
1245: public const APPLICATION_X_CFS_COMPRESSED = 'application/x-cfs-compressed';
1246: public const APPLICATION_X_CHAT = 'application/x-chat';
1247: public const APPLICATION_X_CHESS_PGN = 'application/x-chess-pgn';
1248: public const APPLICATION_X_COMPRESS = 'application/x-compress';
1249: public const APPLICATION_X_CPIO = 'application/x-cpio';
1250: public const APPLICATION_X_CSH = 'application/x-csh';
1251: public const APPLICATION_X_DAR = 'application/x-dar';
1252: public const APPLICATION_X_DEBIAN_PACKAGE = 'application/x-debian-package';
1253: public const APPLICATION_X_DGC_COMPRESSED = 'application/x-dgc-compressed';
1254: public const APPLICATION_X_DIRECTOR = 'application/x-director';
1255: public const APPLICATION_X_DOOM = 'application/x-doom';
1256: public const APPLICATION_X_DTBNCX_XML = 'application/x-dtbncx+xml';
1257: public const APPLICATION_X_DTBOOK_XML = 'application/x-dtbook+xml';
1258: public const APPLICATION_X_DTBRESOURCE_XML = 'application/x-dtbresource+xml';
1259: public const APPLICATION_X_DVI = 'application/x-dvi';
1260: public const APPLICATION_X_FONT_BDF = 'application/x-font-bdf';
1261: public const APPLICATION_X_FONT_GHOSTSCRIPT = 'application/x-font-ghostscript';
1262: public const APPLICATION_X_FONT_LINUX_PSF = 'application/x-font-linux-psf';
1263: public const APPLICATION_X_FONT_OTF = 'application/x-font-otf';
1264: public const APPLICATION_X_FONT_PCF = 'application/x-font-pcf';
1265: public const APPLICATION_X_FONT_SNF = 'application/x-font-snf';
1266: public const APPLICATION_X_FONT_TTF = 'application/x-font-ttf';
1267: public const APPLICATION_X_FONT_TYPE1 = 'application/x-font-type1';
1268: public const APPLICATION_X_FONT_WOFF = 'application/x-font-woff';
1269: public const APPLICATION_X_FUTURESPLASH = 'application/x-futuresplash';
1270: public const APPLICATION_X_GCA_COMPRESSED = 'application/x-gca-compressed';
1271: public const APPLICATION_X_GNUMERIC = 'application/x-gnumeric';
1272: public const APPLICATION_X_GTAR = 'application/x-gtar';
1273: public const APPLICATION_X_HDF = 'application/x-hdf';
1274: public const APPLICATION_X_JAVA_JNLP_FILE = 'application/x-java-jnlp-file';
1275: public const APPLICATION_X_LATEX = 'application/x-latex';
1276: public const APPLICATION_X_LZH = 'application/x-lzh';
1277: public const APPLICATION_X_LZIP = 'application/x-lzip';
1278: public const APPLICATION_X_LZMA = 'application/x-lzma';
1279: public const APPLICATION_X_LZOP = 'application/x-lzop';
1280: public const APPLICATION_X_LZX = 'application/x-lzx';
1281: public const APPLICATION_X_MOBIPOCKET_EBOOK = 'application/x-mobipocket-ebook';
1282: public const APPLICATION_X_MS_APPLICATION = 'application/x-ms-application';
1283: public const APPLICATION_X_MS_WMD = 'application/x-ms-wmd';
1284: public const APPLICATION_X_MS_WMZ = 'application/x-ms-wmz';
1285: public const APPLICATION_X_MS_XBAP = 'application/x-ms-xbap';
1286: public const APPLICATION_X_MSACCESS = 'application/x-msaccess';
1287: public const APPLICATION_X_MSBINDER = 'application/x-msbinder';
1288: public const APPLICATION_X_MSCARDFILE = 'application/x-mscardfile';
1289: public const APPLICATION_X_MSCLIP = 'application/x-msclip';
1290: public const APPLICATION_X_MSDOWNLOAD = 'application/x-msdownload';
1291: public const APPLICATION_X_MSMEDIAVIEW = 'application/x-msmediaview';
1292: public const APPLICATION_X_MSMETAFILE = 'application/x-msmetafile';
1293: public const APPLICATION_X_MSMONEY = 'application/x-msmoney';
1294: public const APPLICATION_X_MSPUBLISHER = 'application/x-mspublisher';
1295: public const APPLICATION_X_MSSCHEDULE = 'application/x-msschedule';
1296: public const APPLICATION_X_MSTERMINAL = 'application/x-msterminal';
1297: public const APPLICATION_X_MSWRITE = 'application/x-mswrite';
1298: public const APPLICATION_X_NETCDF = 'application/x-netcdf';
1299: public const APPLICATION_X_PKCS12 = 'application/x-pkcs12';
1300: public const APPLICATION_X_PKCS7_CERTIFICATES = 'application/x-pkcs7-certificates';
1301: public const APPLICATION_X_PKCS7_CERTREQRESP = 'application/x-pkcs7-certreqresp';
1302: public const APPLICATION_X_RAR_COMPRESSED = 'application/x-rar-compressed';
1303: public const APPLICATION_X_SH = 'application/x-sh';
1304: public const APPLICATION_X_SHAR = 'application/x-shar';
1305: public const APPLICATION_X_SHOCKWAVE_FLASH = 'application/x-shockwave-flash';
1306: public const APPLICATION_X_SILVERLIGHT_APP = 'application/x-silverlight-app';
1307: public const APPLICATION_X_SNAPPY_FRAMED = 'application/x-snappy-framed';
1308: public const APPLICATION_X_STUFFIT = 'application/x-stuffit';
1309: public const APPLICATION_X_STUFFITX = 'application/x-stuffitx';
1310: public const APPLICATION_X_SV4CPIO = 'application/x-sv4cpio';
1311: public const APPLICATION_X_SV4CRC = 'application/x-sv4crc';
1312: public const APPLICATION_X_TAR = 'application/x-tar';
1313: public const APPLICATION_X_TCL = 'application/x-tcl';
1314: public const APPLICATION_X_TEX = 'application/x-tex';
1315: public const APPLICATION_X_TEX_TFM = 'application/x-tex-tfm';
1316: public const APPLICATION_X_TEXINFO = 'application/x-texinfo';
1317: public const APPLICATION_X_USTAR = 'application/x-ustar';
1318: public const APPLICATION_X_WAIS_SOURCE = 'application/x-wais-source';
1319: public const APPLICATION_X_WWW_FORM_URLENCODED = 'application/x-www-form-urlencoded';
1320: public const APPLICATION_X_X509_CA_CERT = 'application/x-x509-ca-cert';
1321: public const APPLICATION_X_XFIG = 'application/x-xfig';
1322: public const APPLICATION_X_XPINSTALL = 'application/x-xpinstall';
1323: public const APPLICATION_X_XZ = 'application/x-xz';
1324: public const APPLICATION_X_ZOO = 'application/x-zoo';
1325: public const APPLICATION_XACML_XML = 'application/xacml+xml';
1326: public const APPLICATION_XCAP_ATT_XML = 'application/xcap-att+xml';
1327: public const APPLICATION_XCAP_CAPS_XML = 'application/xcap-caps+xml';
1328: public const APPLICATION_XCAP_DIFF_XML = 'application/xcap-diff+xml';
1329: public const APPLICATION_XCAP_EL_XML = 'application/xcap-el+xml';
1330: public const APPLICATION_XCAP_ERROR_XML = 'application/xcap-error+xml';
1331: public const APPLICATION_XCAP_NS_XML = 'application/xcap-ns+xml';
1332: public const APPLICATION_XCON_CONFERENCE_INFO_DIFF_XML = 'application/xcon-conference-info-diff+xml';
1333: public const APPLICATION_XCON_CONFERENCE_INFO_XML = 'application/xcon-conference-info+xml';
1334: public const APPLICATION_XENC_XML = 'application/xenc+xml';
1335: public const APPLICATION_XHTML_XML = 'application/xhtml+xml';
1336: public const APPLICATION_XML = 'application/xml';
1337: public const APPLICATION_XML_DTD = 'application/xml-dtd';
1338: public const APPLICATION_XML_EXTERNAL_PARSED_ENTITY = 'application/xml-external-parsed-entity';
1339: public const APPLICATION_XML_PATCH_XML = 'application/xml-patch+xml';
1340: public const APPLICATION_XMPP_XML = 'application/xmpp+xml';
1341: public const APPLICATION_XOP_XML = 'application/xop+xml';
1342: public const APPLICATION_XSLT_XML = 'application/xslt+xml';
1343: public const APPLICATION_XSPF_XML = 'application/xspf+xml';
1344: public const APPLICATION_XV_XML = 'application/xv+xml';
1345: public const APPLICATION_YANG = 'application/yang';
1346: public const APPLICATION_YANG_DATA_JSON = 'application/yang-data+json';
1347: public const APPLICATION_YANG_DATA_XML = 'application/yang-data+xml';
1348: public const APPLICATION_YANG_PATCH_JSON = 'application/yang-patch+json';
1349: public const APPLICATION_YANG_PATCH_XML = 'application/yang-patch+xml';
1350: public const APPLICATION_YIN_XML = 'application/yin+xml';
1351: public const APPLICATION_ZIP = 'application/zip';
1352: public const APPLICATION_ZLIB = 'application/zlib';
1353: public const AUDIO_1D_INTERLEAVED_PARITYFEC = 'audio/1d-interleaved-parityfec';
1354: public const AUDIO_32KADPCM = 'audio/32kadpcm';
1355: public const AUDIO_3GPP = 'audio/3gpp';
1356: public const AUDIO_3GPP2 = 'audio/3gpp2';
1357: public const AUDIO_AC3 = 'audio/ac3';
1358: public const AUDIO_ADPCM = 'audio/adpcm';
1359: public const AUDIO_AMR = 'audio/AMR';
1360: public const AUDIO_AMR_WB = 'audio/AMR-WB';
1361: public const AUDIO_AMR_WB_ = 'audio/amr-wb+';
1362: public const AUDIO_APTX = 'audio/aptx';
1363: public const AUDIO_ASC = 'audio/asc';
1364: public const AUDIO_ATRAC3 = 'audio/ATRAC3';
1365: public const AUDIO_ATRAC_ADVANCED_LOSSLESS = 'audio/ATRAC-ADVANCED-LOSSLESS';
1366: public const AUDIO_ATRAC_X = 'audio/ATRAC-X';
1367: public const AUDIO_BASIC = 'audio/basic';
1368: public const AUDIO_BV16 = 'audio/BV16';
1369: public const AUDIO_BV32 = 'audio/BV32';
1370: public const AUDIO_CLEARMODE = 'audio/clearmode';
1371: public const AUDIO_CN = 'audio/CN';
1372: public const AUDIO_DAT12 = 'audio/DAT12';
1373: public const AUDIO_DLS = 'audio/dls';
1374: public const AUDIO_DSR_ES201108 = 'audio/dsr-es201108';
1375: public const AUDIO_DSR_ES202050 = 'audio/dsr-es202050';
1376: public const AUDIO_DSR_ES202211 = 'audio/dsr-es202211';
1377: public const AUDIO_DSR_ES202212 = 'audio/dsr-es202212';
1378: public const AUDIO_DV = 'audio/DV';
1379: public const AUDIO_DVI4 = 'audio/DVI4';
1380: public const AUDIO_EAC3 = 'audio/eac3';
1381: public const AUDIO_ENCAPRTP = 'audio/encaprtp';
1382: public const AUDIO_EVRC = 'audio/EVRC';
1383: public const AUDIO_EVRC0 = 'audio/EVRC0';
1384: public const AUDIO_EVRC1 = 'audio/EVRC1';
1385: public const AUDIO_EVRC_QCP = 'audio/EVRC-QCP';
1386: public const AUDIO_EVRCB = 'audio/EVRCB';
1387: public const AUDIO_EVRCB0 = 'audio/EVRCB0';
1388: public const AUDIO_EVRCB1 = 'audio/EVRCB1';
1389: public const AUDIO_EVRCNW = 'audio/EVRCNW';
1390: public const AUDIO_EVRCNW0 = 'audio/EVRCNW0';
1391: public const AUDIO_EVRCNW1 = 'audio/EVRCNW1';
1392: public const AUDIO_EVRCWB = 'audio/EVRCWB';
1393: public const AUDIO_EVRCWB0 = 'audio/EVRCWB0';
1394: public const AUDIO_EVRCWB1 = 'audio/EVRCWB1';
1395: public const AUDIO_EVS = 'audio/EVS';
1396: public const AUDIO_EXAMPLE = 'audio/example';
1397: public const AUDIO_FWDRED = 'audio/fwdred';
1398: public const AUDIO_G711_0 = 'audio/G711-0';
1399: public const AUDIO_G719 = 'audio/G719';
1400: public const AUDIO_G722 = 'audio/G722';
1401: public const AUDIO_G7221 = 'audio/G7221';
1402: public const AUDIO_G723 = 'audio/G723';
1403: public const AUDIO_G726_16 = 'audio/G726-16';
1404: public const AUDIO_G726_24 = 'audio/G726-24';
1405: public const AUDIO_G726_32 = 'audio/G726-32';
1406: public const AUDIO_G726_40 = 'audio/G726-40';
1407: public const AUDIO_G728 = 'audio/G728';
1408: public const AUDIO_G729 = 'audio/G729';
1409: public const AUDIO_G729D = 'audio/G729D';
1410: public const AUDIO_G729E = 'audio/G729E';
1411: public const AUDIO_GSM = 'audio/GSM';
1412: public const AUDIO_GSM_EFR = 'audio/GSM-EFR';
1413: public const AUDIO_GSM_HR_08 = 'audio/GSM-HR-08';
1414: public const AUDIO_ILBC = 'audio/iLBC';
1415: public const AUDIO_IP_MR_V2_5 = 'audio/ip-mr_v2.5';
1416: public const AUDIO_L16 = 'audio/L16';
1417: public const AUDIO_L20 = 'audio/L20';
1418: public const AUDIO_L24 = 'audio/L24';
1419: public const AUDIO_L8 = 'audio/L8';
1420: public const AUDIO_LPC = 'audio/LPC';
1421: public const AUDIO_MIDI = 'audio/midi';
1422: public const AUDIO_MOBILE_XMF = 'audio/mobile-xmf';
1423: public const AUDIO_MP4 = 'audio/mp4';
1424: public const AUDIO_MP4A_LATM = 'audio/MP4A-LATM';
1425: public const AUDIO_MPA = 'audio/MPA';
1426: public const AUDIO_MPA_ROBUST = 'audio/mpa-robust';
1427: public const AUDIO_MPEG = 'audio/mpeg';
1428: public const AUDIO_MPEG4_GENERIC = 'audio/mpeg4-generic';
1429: public const AUDIO_OGG = 'audio/ogg';
1430: public const AUDIO_OPUS = 'audio/opus';
1431: public const AUDIO_PCMA = 'audio/PCMA';
1432: public const AUDIO_PCMA_WB = 'audio/PCMA-WB';
1433: public const AUDIO_PCMU = 'audio/PCMU';
1434: public const AUDIO_PCMU_WB = 'audio/PCMU-WB';
1435: public const AUDIO_PRS_SID = 'audio/prs.sid';
1436: public const AUDIO_RAPTORFEC = 'audio/raptorfec';
1437: public const AUDIO_RED = 'audio/RED';
1438: public const AUDIO_RTP_ENC_AESCM128 = 'audio/rtp-enc-aescm128';
1439: public const AUDIO_RTP_MIDI = 'audio/rtp-midi';
1440: public const AUDIO_RTPLOOPBACK = 'audio/rtploopback';
1441: public const AUDIO_RTX = 'audio/rtx';
1442: public const AUDIO_SMV = 'audio/SMV';
1443: public const AUDIO_SMV0 = 'audio/SMV0';
1444: public const AUDIO_SMV_QCP = 'audio/SMV-QCP';
1445: public const AUDIO_SP_MIDI = 'audio/sp-midi';
1446: public const AUDIO_SPEEX = 'audio/speex';
1447: public const AUDIO_T140C = 'audio/t140c';
1448: public const AUDIO_T38 = 'audio/t38';
1449: public const AUDIO_TELEPHONE_EVENT = 'audio/telephone-event';
1450: public const AUDIO_TONE = 'audio/tone';
1451: public const AUDIO_UEMCLIP = 'audio/UEMCLIP';
1452: public const AUDIO_ULPFEC = 'audio/ulpfec';
1453: public const AUDIO_VDVI = 'audio/VDVI';
1454: public const AUDIO_VMR_WB = 'audio/VMR-WB';
1455: public const AUDIO_VND_3GPP_IUFP = 'audio/vnd.3gpp.iufp';
1456: public const AUDIO_VND_4SB = 'audio/vnd.4SB';
1457: public const AUDIO_VND_AUDIOKOZ = 'audio/vnd.audiokoz';
1458: public const AUDIO_VND_CELP = 'audio/vnd.CELP';
1459: public const AUDIO_VND_CISCO_NSE = 'audio/vnd.cisco.nse';
1460: public const AUDIO_VND_CMLES_RADIO_EVENTS = 'audio/vnd.cmles.radio-events';
1461: public const AUDIO_VND_CNS_ANP1 = 'audio/vnd.cns.anp1';
1462: public const AUDIO_VND_CNS_INF1 = 'audio/vnd.cns.inf1';
1463: public const AUDIO_VND_DECE_AUDIO = 'audio/vnd.dece.audio';
1464: public const AUDIO_VND_DIGITAL_WINDS = 'audio/vnd.digital-winds';
1465: public const AUDIO_VND_DLNA_ADTS = 'audio/vnd.dlna.adts';
1466: public const AUDIO_VND_DOLBY_HEAAC_1 = 'audio/vnd.dolby.heaac.1';
1467: public const AUDIO_VND_DOLBY_HEAAC_2 = 'audio/vnd.dolby.heaac.2';
1468: public const AUDIO_VND_DOLBY_MLP = 'audio/vnd.dolby.mlp';
1469: public const AUDIO_VND_DOLBY_MPS = 'audio/vnd.dolby.mps';
1470: public const AUDIO_VND_DOLBY_PL2 = 'audio/vnd.dolby.pl2';
1471: public const AUDIO_VND_DOLBY_PL2X = 'audio/vnd.dolby.pl2x';
1472: public const AUDIO_VND_DOLBY_PL2Z = 'audio/vnd.dolby.pl2z';
1473: public const AUDIO_VND_DOLBY_PULSE_1 = 'audio/vnd.dolby.pulse.1';
1474: public const AUDIO_VND_DRA = 'audio/vnd.dra';
1475: public const AUDIO_VND_DTS = 'audio/vnd.dts';
1476: public const AUDIO_VND_DTS_HD = 'audio/vnd.dts.hd';
1477: public const AUDIO_VND_DVB_FILE = 'audio/vnd.dvb.file';
1478: public const AUDIO_VND_EVERAD_PLJ = 'audio/vnd.everad.plj';
1479: public const AUDIO_VND_HNS_AUDIO = 'audio/vnd.hns.audio';
1480: public const AUDIO_VND_LUCENT_VOICE = 'audio/vnd.lucent.voice';
1481: public const AUDIO_VND_MS_PLAYREADY_MEDIA_PYA = 'audio/vnd.ms-playready.media.pya';
1482: public const AUDIO_VND_NOKIA_MOBILE_XMF = 'audio/vnd.nokia.mobile-xmf';
1483: public const AUDIO_VND_NORTEL_VBK = 'audio/vnd.nortel.vbk';
1484: public const AUDIO_VND_NUERA_ECELP4800 = 'audio/vnd.nuera.ecelp4800';
1485: public const AUDIO_VND_NUERA_ECELP7470 = 'audio/vnd.nuera.ecelp7470';
1486: public const AUDIO_VND_NUERA_ECELP9600 = 'audio/vnd.nuera.ecelp9600';
1487: public const AUDIO_VND_OCTEL_SBC = 'audio/vnd.octel.sbc';
1488: public const AUDIO_VND_QCELP = 'audio/vnd.qcelp';
1489: public const AUDIO_VND_RHETOREX_32KADPCM = 'audio/vnd.rhetorex.32kadpcm';
1490: public const AUDIO_VND_RIP = 'audio/vnd.rip';
1491: public const AUDIO_VND_SEALEDMEDIA_SOFTSEAL_MPEG = 'audio/vnd.sealedmedia.softseal-mpeg';
1492: public const AUDIO_VND_VMX_CVSD = 'audio/vnd.vmx.cvsd';
1493: public const AUDIO_VORBIS = 'audio/vorbis';
1494: public const AUDIO_VORBIS_CONFIG = 'audio/vorbis-config';
1495: public const AUDIO_WEBM = 'audio/webm';
1496: public const AUDIO_X_AAC = 'audio/x-aac';
1497: public const AUDIO_X_AIFF = 'audio/x-aiff';
1498: public const AUDIO_X_MPEGURL = 'audio/x-mpegurl';
1499: public const AUDIO_X_MS_WAX = 'audio/x-ms-wax';
1500: public const AUDIO_X_MS_WMA = 'audio/x-ms-wma';
1501: public const AUDIO_X_PN_REALAUDIO = 'audio/x-pn-realaudio';
1502: public const AUDIO_X_PN_REALAUDIO_PLUGIN = 'audio/x-pn-realaudio-plugin';
1503: public const AUDIO_X_WAV = 'audio/x-wav';
1504: public const CHEMICAL_X_CDX = 'chemical/x-cdx';
1505: public const CHEMICAL_X_CIF = 'chemical/x-cif';
1506: public const CHEMICAL_X_CMDF = 'chemical/x-cmdf';
1507: public const CHEMICAL_X_CML = 'chemical/x-cml';
1508: public const CHEMICAL_X_CSML = 'chemical/x-csml';
1509: public const CHEMICAL_X_XYZ = 'chemical/x-xyz';
1510: public const FONT_COLLECTION = 'font/collection';
1511: public const FONT_OTF = 'font/otf';
1512: public const FONT_SFNT = 'font/sfnt';
1513: public const FONT_TTF = 'font/ttf';
1514: public const FONT_WOFF = 'font/woff';
1515: public const FONT_WOFF2 = 'font/woff2';
1516: public const IMAGE_BMP = 'image/bmp';
1517: public const IMAGE_CGM = 'image/cgm';
1518: public const IMAGE_DICOM_RLE = 'image/dicom-rle';
1519: public const IMAGE_EMF = 'image/emf';
1520: public const IMAGE_EXAMPLE = 'image/example';
1521: public const IMAGE_FITS = 'image/fits';
1522: public const IMAGE_G3FAX = 'image/g3fax';
1523: public const IMAGE_GIF = 'image/gif';
1524: public const IMAGE_IEF = 'image/ief';
1525: public const IMAGE_JLS = 'image/jls';
1526: public const IMAGE_JP2 = 'image/jp2';
1527: public const IMAGE_JPEG = 'image/jpeg';
1528: public const IMAGE_JPM = 'image/jpm';
1529: public const IMAGE_JPX = 'image/jpx';
1530: public const IMAGE_KTX = 'image/ktx';
1531: public const IMAGE_NAPLPS = 'image/naplps';
1532: public const IMAGE_PJPEG = 'image/pjpeg';
1533: public const IMAGE_PNG = 'image/png';
1534: public const IMAGE_PRS_BTIF = 'image/prs.btif';
1535: public const IMAGE_PRS_PTI = 'image/prs.pti';
1536: public const IMAGE_PWG_RASTER = 'image/pwg-raster';
1537: public const IMAGE_SVG_XML = 'image/svg+xml';
1538: public const IMAGE_T38 = 'image/t38';
1539: public const IMAGE_TIFF = 'image/tiff';
1540: public const IMAGE_TIFF_FX = 'image/tiff-fx';
1541: public const IMAGE_VND_ADOBE_PHOTOSHOP = 'image/vnd.adobe.photoshop';
1542: public const IMAGE_VND_AIRZIP_ACCELERATOR_AZV = 'image/vnd.airzip.accelerator.azv';
1543: public const IMAGE_VND_CNS_INF2 = 'image/vnd.cns.inf2';
1544: public const IMAGE_VND_DECE_GRAPHIC = 'image/vnd.dece.graphic';
1545: public const IMAGE_VND_DJVU = 'image/vnd-djvu';
1546: public const IMAGE_VND_DVB_SUBTITLE = 'image/vnd.dvb.subtitle';
1547: public const IMAGE_VND_DWG = 'image/vnd.dwg';
1548: public const IMAGE_VND_DXF = 'image/vnd.dxf';
1549: public const IMAGE_VND_FASTBIDSHEET = 'image/vnd.fastbidsheet';
1550: public const IMAGE_VND_FPX = 'image/vnd.fpx';
1551: public const IMAGE_VND_FST = 'image/vnd.fst';
1552: public const IMAGE_VND_FUJIXEROX_EDMICS_MMR = 'image/vnd.fujixerox.edmics-mmr';
1553: public const IMAGE_VND_FUJIXEROX_EDMICS_RLC = 'image/vnd.fujixerox.edmics-rlc';
1554: public const IMAGE_VND_GLOBALGRAPHICS_PGB = 'image/vnd.globalgraphics.pgb';
1555: public const IMAGE_VND_MICROSOFT_ICON = 'image/vnd.microsoft.icon';
1556: public const IMAGE_VND_MIX = 'image/vnd.mix';
1557: public const IMAGE_VND_MOZILLA_APNG = 'image/vnd.mozilla.apng';
1558: public const IMAGE_VND_MS_MODI = 'image/vnd.ms-modi';
1559: public const IMAGE_VND_NET_FPX = 'image/vnd.net-fpx';
1560: public const IMAGE_VND_RADIANCE = 'image/vnd.radiance';
1561: public const IMAGE_VND_SEALED_PNG = 'image/vnd.sealed-png';
1562: public const IMAGE_VND_SEALEDMEDIA_SOFTSEAL_GIF = 'image/vnd.sealedmedia.softseal-gif';
1563: public const IMAGE_VND_SEALEDMEDIA_SOFTSEAL_JPG = 'image/vnd.sealedmedia.softseal-jpg';
1564: public const IMAGE_VND_SVF = 'image/vnd-svf';
1565: public const IMAGE_VND_TENCENT_TAP = 'image/vnd.tencent.tap';
1566: public const IMAGE_VND_VALVE_SOURCE_TEXTURE = 'image/vnd.valve.source.texture';
1567: public const IMAGE_VND_WAP_WBMP = 'image/vnd-wap-wbmp';
1568: public const IMAGE_VND_XIFF = 'image/vnd.xiff';
1569: public const IMAGE_VND_ZBRUSH_PCX = 'image/vnd.zbrush.pcx';
1570: public const IMAGE_WEBP = 'image/webp';
1571: public const IMAGE_WMF = 'image/wmf';
1572: public const IMAGE_X_CITRIX_JPEG = 'image/x-citrix-jpeg';
1573: public const IMAGE_X_CITRIX_PNG = 'image/x-citrix-png';
1574: public const IMAGE_X_CMU_RASTER = 'image/x-cmu-raster';
1575: public const IMAGE_X_CMX = 'image/x-cmx';
1576: public const IMAGE_X_FREEHAND = 'image/x-freehand';
1577: public const IMAGE_X_ICON = 'image/x-icon';
1578: public const IMAGE_X_PCX = 'image/x-pcx';
1579: public const IMAGE_X_PICT = 'image/x-pict';
1580: public const IMAGE_X_PNG = 'image/x-png';
1581: public const IMAGE_X_PORTABLE_ANYMAP = 'image/x-portable-anymap';
1582: public const IMAGE_X_PORTABLE_BITMAP = 'image/x-portable-bitmap';
1583: public const IMAGE_X_PORTABLE_GRAYMAP = 'image/x-portable-graymap';
1584: public const IMAGE_X_PORTABLE_PIXMAP = 'image/x-portable-pixmap';
1585: public const IMAGE_X_RGB = 'image/x-rgb';
1586: public const IMAGE_X_XBITMAP = 'image/x-xbitmap';
1587: public const IMAGE_X_XPIXMAP = 'image/x-xpixmap';
1588: public const IMAGE_X_XWINDOWDUMP = 'image/x-xwindowdump';
1589: public const MESSAGE_CPIM = 'message/CPIM';
1590: public const MESSAGE_DELIVERY_STATUS = 'message/delivery-status';
1591: public const MESSAGE_DISPOSITION_NOTIFICATION = 'message/disposition-notification';
1592: public const MESSAGE_EXAMPLE = 'message/example';
1593: public const MESSAGE_FEEDBACK_REPORT = 'message/feedback-report';
1594: public const MESSAGE_GLOBAL = 'message/global';
1595: public const MESSAGE_GLOBAL_DELIVERY_STATUS = 'message/global-delivery-status';
1596: public const MESSAGE_GLOBAL_DISPOSITION_NOTIFICATION = 'message/global-disposition-notification';
1597: public const MESSAGE_GLOBAL_HEADERS = 'message/global-headers';
1598: public const MESSAGE_HTTP = 'message/http';
1599: public const MESSAGE_IMDN_XML = 'message/imdn+xml';
1600: public const MESSAGE_NEWS = 'message/news';
1601: public const MESSAGE_RFC822 = 'message/rfc822';
1602: public const MESSAGE_S_HTTP = 'message/s-http';
1603: public const MESSAGE_SIP = 'message/sip';
1604: public const MESSAGE_SIPFRAG = 'message/sipfrag';
1605: public const MESSAGE_TRACKING_STATUS = 'message/tracking-status';
1606: public const MESSAGE_VND_SI_SIMP = 'message/vnd.si.simp';
1607: public const MESSAGE_VND_WFA_WSC = 'message/vnd.wfa.wsc';
1608: public const MODEL_EXAMPLE = 'model/example';
1609: public const MODEL_GLTF_JSON = 'model/gltf+json';
1610: public const MODEL_IGES = 'model/iges';
1611: public const MODEL_MESH = 'model/mesh';
1612: public const MODEL_VND_COLLADA_XML = 'model/vnd.collada+xml';
1613: public const MODEL_VND_DWF = 'model/vnd-dwf';
1614: public const MODEL_VND_FLATLAND_3DML = 'model/vnd.flatland.3dml';
1615: public const MODEL_VND_GDL = 'model/vnd.gdl';
1616: public const MODEL_VND_GS_GDL = 'model/vnd.gs-gdl';
1617: public const MODEL_VND_GTW = 'model/vnd.gtw';
1618: public const MODEL_VND_MOML_XML = 'model/vnd.moml+xml';
1619: public const MODEL_VND_MTS = 'model/vnd.mts';
1620: public const MODEL_VND_OPENGEX = 'model/vnd.opengex';
1621: public const MODEL_VND_PARASOLID_TRANSMIT_BINARY = 'model/vnd.parasolid.transmit-binary';
1622: public const MODEL_VND_PARASOLID_TRANSMIT_TEXT = 'model/vnd.parasolid.transmit-text';
1623: public const MODEL_VND_ROSETTE_ANNOTATED_DATA_MODEL = 'model/vnd.rosette.annotated-data-model';
1624: public const MODEL_VND_VALVE_SOURCE_COMPILED_MAP = 'model/vnd.valve.source.compiled-map';
1625: public const MODEL_VND_VTU = 'model/vnd.vtu';
1626: public const MODEL_VRML = 'model/vrml';
1627: public const MODEL_X3D_FASTINFOSET = 'model/x3d+fastinfoset';
1628: public const MODEL_X3D_VRML = 'model/x3d-vrml';
1629: public const MODEL_X3D_XML = 'model/x3d+xml';
1630: public const MULTIPART_APPLEDOUBLE = 'multipart/appledouble';
1631: public const MULTIPART_BYTERANGES = 'multipart/byteranges';
1632: public const MULTIPART_ENCRYPTED = 'multipart/encrypted';
1633: public const MULTIPART_EXAMPLE = 'multipart/example';
1634: public const MULTIPART_FORM_DATA = 'multipart/form-data';
1635: public const MULTIPART_HEADER_SET = 'multipart/header-set';
1636: public const MULTIPART_RELATED = 'multipart/related';
1637: public const MULTIPART_REPORT = 'multipart/report';
1638: public const MULTIPART_SIGNED = 'multipart/signed';
1639: public const MULTIPART_VOICE_MESSAGE = 'multipart/voice-message';
1640: public const MULTIPART_X_MIXED_REPLACE = 'multipart/x-mixed-replace';
1641: public const TEXT_1D_INTERLEAVED_PARITYFEC = 'text/1d-interleaved-parityfec';
1642: public const TEXT_CACHE_MANIFEST = 'text/cache-manifest';
1643: public const TEXT_CALENDAR = 'text/calendar';
1644: public const TEXT_CSS = 'text/css';
1645: public const TEXT_CSV = 'text/csv';
1646: public const TEXT_CSV_SCHEMA = 'text/csv-schema';
1647: public const TEXT_DIRECTORY = 'text/directory';
1648: public const TEXT_DNS = 'text/dns';
1649: public const TEXT_ECMASCRIPT = 'text/ecmascript';
1650: public const TEXT_ENCAPRTP = 'text/encaprtp';
1651: public const TEXT_EXAMPLE = 'text/example';
1652: public const TEXT_FWDRED = 'text/fwdred';
1653: public const TEXT_GRAMMAR_REF_LIST = 'text/grammar-ref-list';
1654: public const TEXT_HTML = 'text/html';
1655: public const TEXT_JAVASCRIPT = 'text/javascript';
1656: public const TEXT_JCR_CND = 'text/jcr-cnd';
1657: public const TEXT_MARKDOWN = 'text/markdown';
1658: public const TEXT_MIZAR = 'text/mizar';
1659: public const TEXT_N3 = 'text/n3';
1660: public const TEXT_PARAMETERS = 'text/parameters';
1661: public const TEXT_PLAIN = 'text/plain';
1662: public const TEXT_PLAIN_BAS = 'text/plain-bas';
1663: public const TEXT_PROVENANCE_NOTATION = 'text/provenance-notation';
1664: public const TEXT_PRS_FALLENSTEIN_RST = 'text/prs.fallenstein.rst';
1665: public const TEXT_PRS_LINES_TAG = 'text/prs.lines.tag';
1666: public const TEXT_PRS_PROP_LOGIC = 'text/prs.prop.logic';
1667: public const TEXT_RAPTORFEC = 'text/raptorfec';
1668: public const TEXT_RED = 'text/RED';
1669: public const TEXT_RFC822_HEADERS = 'text/rfc822-headers';
1670: public const TEXT_RICHTEXT = 'text/richtext';
1671: public const TEXT_RTF = 'text/rtf';
1672: public const TEXT_RTP_ENC_AESCM128 = 'text/rtp-enc-aescm128';
1673: public const TEXT_RTPLOOPBACK = 'text/rtploopback';
1674: public const TEXT_RTX = 'text/rtx';
1675: public const TEXT_SGML = 'text/SGML';
1676: public const TEXT_T140 = 'text/t140';
1677: public const TEXT_TAB_SEPARATED_VALUES = 'text/tab-separated-values';
1678: public const TEXT_TROFF = 'text/troff';
1679: public const TEXT_TURTLE = 'text/turtle';
1680: public const TEXT_ULPFEC = 'text/ulpfec';
1681: public const TEXT_URI_LIST = 'text/uri-list';
1682: public const TEXT_VCARD = 'text/vcard';
1683: public const TEXT_VND_A = 'text/vnd-a';
1684: public const TEXT_VND_ABC = 'text/vnd.abc';
1685: public const TEXT_VND_ASCII_ART = 'text/vnd.ascii-art';
1686: public const TEXT_VND_CURL = 'text/vnd-curl';
1687: public const TEXT_VND_CURL_DCURL = 'text/vnd.curl.dcurl';
1688: public const TEXT_VND_CURL_MCURL = 'text/vnd.curl.mcurl';
1689: public const TEXT_VND_CURL_SCURL = 'text/vnd.curl.scurl';
1690: public const TEXT_VND_DEBIAN_COPYRIGHT = 'text/vnd.debian.copyright';
1691: public const TEXT_VND_DMCLIENTSCRIPT = 'text/vnd.DMClientScript';
1692: public const TEXT_VND_DVB_SUBTITLE = 'text/vnd.dvb.subtitle';
1693: public const TEXT_VND_ESMERTEC_THEME_DESCRIPTOR = 'text/vnd.esmertec.theme-descriptor';
1694: public const TEXT_VND_FLY = 'text/vnd.fly';
1695: public const TEXT_VND_FMI_FLEXSTOR = 'text/vnd.fmi.flexstor';
1696: public const TEXT_VND_GRAPHVIZ = 'text/vnd.graphviz';
1697: public const TEXT_VND_IN3D_3DML = 'text/vnd.in3d.3dml';
1698: public const TEXT_VND_IN3D_SPOT = 'text/vnd.in3d.spot';
1699: public const TEXT_VND_IPTC_NEWSML = 'text/vnd.IPTC.NewsML';
1700: public const TEXT_VND_IPTC_NITF = 'text/vnd.IPTC.NITF';
1701: public const TEXT_VND_LATEX_Z = 'text/vnd.latex-z';
1702: public const TEXT_VND_MOTOROLA_REFLEX = 'text/vnd.motorola.reflex';
1703: public const TEXT_VND_MS_MEDIAPACKAGE = 'text/vnd.ms-mediapackage';
1704: public const TEXT_VND_NET2PHONE_COMMCENTER_COMMAND = 'text/vnd.net2phone.commcenter.command';
1705: public const TEXT_VND_RADISYS_MSML_BASIC_LAYOUT = 'text/vnd.radisys.msml-basic-layout';
1706: public const TEXT_VND_SI_URICATALOGUE = 'text/vnd.si.uricatalogue';
1707: public const TEXT_VND_SUN_J2ME_APP_DESCRIPTOR = 'text/vnd.sun.j2me.app-descriptor';
1708: public const TEXT_VND_TROLLTECH_LINGUIST = 'text/vnd.trolltech.linguist';
1709: public const TEXT_VND_WAP_SI = 'text/vnd.wap.si';
1710: public const TEXT_VND_WAP_SL = 'text/vnd.wap.sl';
1711: public const TEXT_VND_WAP_WML = 'text/vnd.wap-wml';
1712: public const TEXT_VND_WAP_WMLSCRIPT = 'text/vnd.wap.wmlscript';
1713: public const TEXT_X_ASM = 'text/x-asm';
1714: public const TEXT_X_C = 'text/x-c';
1715: public const TEXT_X_FORTRAN = 'text/x-fortran';
1716: public const TEXT_X_JAVA_SOURCE_JAVA = 'text/x-java-source,java';
1717: public const TEXT_X_PASCAL = 'text/x-pascal';
1718: public const TEXT_X_SETEXT = 'text/x-setext';
1719: public const TEXT_X_UUENCODE = 'text/x-uuencode';
1720: public const TEXT_X_VCALENDAR = 'text/x-vcalendar';
1721: public const TEXT_X_VCARD = 'text/x-vcard';
1722: public const TEXT_XML = 'text/xml';
1723: public const TEXT_XML_EXTERNAL_PARSED_ENTITY = 'text/xml-external-parsed-entity';
1724: public const TEXT_YAML = 'text/yaml';
1725: public const VIDEO_1D_INTERLEAVED_PARITYFEC = 'video/1d-interleaved-parityfec';
1726: public const VIDEO_3GPP = 'video/3gpp';
1727: public const VIDEO_3GPP2 = 'video/3gpp2';
1728: public const VIDEO_3GPP_TT = 'video/3gpp-tt';
1729: public const VIDEO_BMPEG = 'video/BMPEG';
1730: public const VIDEO_BT656 = 'video/BT656';
1731: public const VIDEO_CELB = 'video/CelB';
1732: public const VIDEO_DV = 'video/DV';
1733: public const VIDEO_ENCAPRTP = 'video/encaprtp';
1734: public const VIDEO_EXAMPLE = 'video/example';
1735: public const VIDEO_H261 = 'video/H261';
1736: public const VIDEO_H263 = 'video/H263';
1737: public const VIDEO_H263_1998 = 'video/H263-1998';
1738: public const VIDEO_H263_2000 = 'video/H263-2000';
1739: public const VIDEO_H264 = 'video/H264';
1740: public const VIDEO_H264_RCDO = 'video/H264-RCDO';
1741: public const VIDEO_H264_SVC = 'video/H264-SVC';
1742: public const VIDEO_H265 = 'video/H265';
1743: public const VIDEO_ISO_SEGMENT = 'video/iso.segment';
1744: public const VIDEO_JPEG = 'video/JPEG';
1745: public const VIDEO_JPEG2000 = 'video/jpeg2000';
1746: public const VIDEO_JPM = 'video/jpm';
1747: public const VIDEO_MJ2 = 'video/mj2';
1748: public const VIDEO_MP1S = 'video/MP1S';
1749: public const VIDEO_MP2P = 'video/MP2P';
1750: public const VIDEO_MP2T = 'video/MP2T';
1751: public const VIDEO_MP4 = 'video/mp4';
1752: public const VIDEO_MP4V_ES = 'video/MP4V-ES';
1753: public const VIDEO_MPEG = 'video/mpeg';
1754: public const VIDEO_MPEG4_GENERIC = 'video/mpeg4-generic';
1755: public const VIDEO_MPV = 'video/MPV';
1756: public const VIDEO_NV = 'video/nv';
1757: public const VIDEO_OGG = 'video/ogg';
1758: public const VIDEO_POINTER = 'video/pointer';
1759: public const VIDEO_QUICKTIME = 'video/quicktime';
1760: public const VIDEO_RAPTORFEC = 'video/raptorfec';
1761: public const VIDEO_RTP_ENC_AESCM128 = 'video/rtp-enc-aescm128';
1762: public const VIDEO_RTPLOOPBACK = 'video/rtploopback';
1763: public const VIDEO_RTX = 'video/rtx';
1764: public const VIDEO_SMPTE292M = 'video/SMPTE292M';
1765: public const VIDEO_ULPFEC = 'video/ulpfec';
1766: public const VIDEO_VC1 = 'video/vc1';
1767: public const VIDEO_VND_CCTV = 'video/vnd.CCTV';
1768: public const VIDEO_VND_DECE_HD = 'video/vnd.dece.hd';
1769: public const VIDEO_VND_DECE_MOBILE = 'video/vnd.dece.mobile';
1770: public const VIDEO_VND_DECE_MP4 = 'video/vnd.dece-mp4';
1771: public const VIDEO_VND_DECE_PD = 'video/vnd.dece.pd';
1772: public const VIDEO_VND_DECE_SD = 'video/vnd.dece.sd';
1773: public const VIDEO_VND_DECE_VIDEO = 'video/vnd.dece.video';
1774: public const VIDEO_VND_DIRECTV_MPEG = 'video/vnd.directv-mpeg';
1775: public const VIDEO_VND_DIRECTV_MPEG_TTS = 'video/vnd.directv.mpeg-tts';
1776: public const VIDEO_VND_DLNA_MPEG_TTS = 'video/vnd.dlna.mpeg-tts';
1777: public const VIDEO_VND_DVB_FILE = 'video/vnd.dvb.file';
1778: public const VIDEO_VND_FVT = 'video/vnd.fvt';
1779: public const VIDEO_VND_HNS_VIDEO = 'video/vnd.hns.video';
1780: public const VIDEO_VND_IPTVFORUM_1DPARITYFEC_1010 = 'video/vnd.iptvforum.1dparityfec-1010';
1781: public const VIDEO_VND_IPTVFORUM_1DPARITYFEC_2005 = 'video/vnd.iptvforum.1dparityfec-2005';
1782: public const VIDEO_VND_IPTVFORUM_2DPARITYFEC_1010 = 'video/vnd.iptvforum.2dparityfec-1010';
1783: public const VIDEO_VND_IPTVFORUM_2DPARITYFEC_2005 = 'video/vnd.iptvforum.2dparityfec-2005';
1784: public const VIDEO_VND_IPTVFORUM_TTSAVC = 'video/vnd.iptvforum.ttsavc';
1785: public const VIDEO_VND_IPTVFORUM_TTSMPEG2 = 'video/vnd.iptvforum.ttsmpeg2';
1786: public const VIDEO_VND_MOTOROLA_VIDEO = 'video/vnd.motorola.video';
1787: public const VIDEO_VND_MOTOROLA_VIDEOP = 'video/vnd.motorola.videop';
1788: public const VIDEO_VND_MPEGURL = 'video/vnd-mpegurl';
1789: public const VIDEO_VND_MS_PLAYREADY_MEDIA_PYV = 'video/vnd.ms-playready.media.pyv';
1790: public const VIDEO_VND_NOKIA_INTERLEAVED_MULTIMEDIA = 'video/vnd.nokia.interleaved-multimedia';
1791: public const VIDEO_VND_NOKIA_VIDEOVOIP = 'video/vnd.nokia.videovoip';
1792: public const VIDEO_VND_OBJECTVIDEO = 'video/vnd.objectvideo';
1793: public const VIDEO_VND_RADGAMETTOOLS_BINK = 'video/vnd.radgamettools.bink';
1794: public const VIDEO_VND_RADGAMETTOOLS_SMACKER = 'video/vnd.radgamettools.smacker';
1795: public const VIDEO_VND_SEALED_MPEG1 = 'video/vnd.sealed.mpeg1';
1796: public const VIDEO_VND_SEALED_MPEG4 = 'video/vnd.sealed.mpeg4';
1797: public const VIDEO_VND_SEALED_SWF = 'video/vnd.sealed-swf';
1798: public const VIDEO_VND_SEALEDMEDIA_SOFTSEAL_MOV = 'video/vnd.sealedmedia.softseal-mov';
1799: public const VIDEO_VND_UVVU_MP4 = 'video/vnd.uvvu-mp4';
1800: public const VIDEO_VND_VIVO = 'video/vnd-vivo';
1801: public const VIDEO_VP8 = 'video/VP8';
1802: public const VIDEO_WEBM = 'video/webm';
1803: public const VIDEO_X_F4V = 'video/x-f4v';
1804: public const VIDEO_X_FLI = 'video/x-fli';
1805: public const VIDEO_X_FLV = 'video/x-flv';
1806: public const VIDEO_X_M4V = 'video/x-m4v';
1807: public const VIDEO_X_MS_ASF = 'video/x-ms-asf';
1808: public const VIDEO_X_MS_WM = 'video/x-ms-wm';
1809: public const VIDEO_X_MS_WMV = 'video/x-ms-wmv';
1810: public const VIDEO_X_MS_WMX = 'video/x-ms-wmx';
1811: public const VIDEO_X_MS_WVX = 'video/x-ms-wvx';
1812: public const VIDEO_X_MSVIDEO = 'video/x-msvideo';
1813: public const VIDEO_X_SGI_MOVIE = 'video/x-sgi-movie';
1814: public const X_CONFERENCE_X_COOLTALK = 'x-conference/x-cooltalk';
1815:
1816: /** @var string[] */
1817: private static $extensions = [
1818: '123' => self::APPLICATION_VND_LOTUS_1_2_3,
1819: '3dml' => self::TEXT_VND_IN3D_3DML,
1820: '3g2' => self::VIDEO_3GPP2,
1821: '3gp' => self::VIDEO_3GPP,
1822: '7z' => self::APPLICATION_X_7Z_COMPRESSED,
1823: 'aab' => self::APPLICATION_X_AUTHORWARE_BIN,
1824: 'aac' => self::AUDIO_X_AAC,
1825: 'aam' => self::APPLICATION_X_AUTHORWARE_MAP,
1826: 'aas' => self::APPLICATION_X_AUTHORWARE_SEG,
1827: 'abw' => self::APPLICATION_X_ABIWORD,
1828: 'ac' => self::APPLICATION_PKIX_ATTR_CERT,
1829: 'acc' => self::APPLICATION_VND_AMERICANDYNAMICS_ACC,
1830: 'ace' => self::APPLICATION_X_ACE_COMPRESSED,
1831: 'acu' => self::APPLICATION_VND_ACUCOBOL,
1832: 'adp' => self::AUDIO_ADPCM,
1833: 'aep' => self::APPLICATION_VND_AUDIOGRAPH,
1834: 'afa' => self::APPLICATION_X_ASTROTITE_AFA,
1835: 'afp' => self::APPLICATION_VND_IBM_MODCAP,
1836: 'ahead' => self::APPLICATION_VND_AHEAD_SPACE,
1837: 'ai' => self::APPLICATION_POSTSCRIPT,
1838: 'aif' => self::AUDIO_X_AIFF,
1839: 'air' => self::APPLICATION_VND_ADOBE_AIR_APPLICATION_INSTALLER_PACKAGE_ZIP,
1840: 'ait' => self::APPLICATION_VND_DVB_AIT,
1841: 'alz' => self::APPLICATION_X_ALZ_COMPRESSED,
1842: 'ami' => self::APPLICATION_VND_AMIGA_AMI,
1843: 'apk' => self::APPLICATION_VND_ANDROID_PACKAGE_ARCHIVE,
1844: 'application' => self::APPLICATION_X_MS_APPLICATION,
1845: 'apr' => self::APPLICATION_VND_LOTUS_APPROACH,
1846: 'arj' => self::APPLICATION_X_ARJ,
1847: 'asf' => self::VIDEO_X_MS_ASF,
1848: 'aso' => self::APPLICATION_VND_ACCPAC_SIMPLY_ASO,
1849: 'atc' => self::APPLICATION_VND_ACUCORP,
1850: 'atom' => self::APPLICATION_ATOM_XML,
1851: 'atomcat' => self::APPLICATION_ATOMCAT_XML,
1852: 'atomsvc' => self::APPLICATION_ATOMSVC_XML,
1853: 'atx' => self::APPLICATION_VND_ANTIX_GAME_COMPONENT,
1854: 'au' => self::AUDIO_BASIC,
1855: 'avi' => self::VIDEO_X_MSVIDEO,
1856: 'aw' => self::APPLICATION_APPLIXWARE,
1857: 'azf' => self::APPLICATION_VND_AIRZIP_FILESECURE_AZF,
1858: 'azs' => self::APPLICATION_VND_AIRZIP_FILESECURE_AZS,
1859: 'azw' => self::APPLICATION_VND_AMAZON_EBOOK,
1860: 'b1' => self::APPLICATION_X_B1,
1861: 'bcpio' => self::APPLICATION_X_BCPIO,
1862: 'bdf' => self::APPLICATION_X_FONT_BDF,
1863: 'bdm' => self::APPLICATION_VND_SYNCML_DM_WBXML,
1864: 'bed' => self::APPLICATION_VND_REALVNC_BED,
1865: 'bh2' => self::APPLICATION_VND_FUJITSU_OASYSPRS,
1866: 'bin' => self::APPLICATION_OCTET_STREAM,
1867: 'bmi' => self::APPLICATION_VND_BMI,
1868: 'bmp' => self::IMAGE_BMP,
1869: 'box' => self::APPLICATION_VND_PREVIEWSYSTEMS_BOX,
1870: 'btif' => self::IMAGE_PRS_BTIF,
1871: 'bz' => self::APPLICATION_X_BZIP,
1872: 'bz2' => self::APPLICATION_X_BZIP2,
1873: 'c' => self::TEXT_X_C,
1874: 'c11amc' => self::APPLICATION_VND_CLUETRUST_CARTOMOBILE_CONFIG,
1875: 'c11amz' => self::APPLICATION_VND_CLUETRUST_CARTOMOBILE_CONFIG_PKG,
1876: 'c4g' => self::APPLICATION_VND_CLONK_C4GROUP,
1877: 'cab' => self::APPLICATION_VND_MS_CAB_COMPRESSED,
1878: 'car' => self::APPLICATION_VND_CURL_CAR,
1879: 'cat' => self::APPLICATION_VND_MS_PKI_SECCAT,
1880: 'ccxml' => self::APPLICATION_CCXML_XML,
1881: 'cdbcmsg' => self::APPLICATION_VND_CONTACT_CMSG,
1882: 'cdkey' => self::APPLICATION_VND_MEDIASTATION_CDKEY,
1883: 'cdmia' => self::APPLICATION_CDMI_CAPABILITY,
1884: 'cdmic' => self::APPLICATION_CDMI_CONTAINER,
1885: 'cdmid' => self::APPLICATION_CDMI_DOMAIN,
1886: 'cdmio' => self::APPLICATION_CDMI_OBJECT,
1887: 'cdmiq' => self::APPLICATION_CDMI_QUEUE,
1888: 'cdx' => self::CHEMICAL_X_CDX,
1889: 'cdxml' => self::APPLICATION_VND_CHEMDRAW_XML,
1890: 'cdy' => self::APPLICATION_VND_CINDERELLA,
1891: 'cer' => self::APPLICATION_PKIX_CERT,
1892: 'cfs' => self::APPLICATION_X_CFS_COMPRESSED,
1893: 'cgm' => self::IMAGE_CGM,
1894: 'chat' => self::APPLICATION_X_CHAT,
1895: 'chm' => self::APPLICATION_VND_MS_HTMLHELP,
1896: 'chrt' => self::APPLICATION_VND_KDE_KCHART,
1897: 'cif' => self::CHEMICAL_X_CIF,
1898: 'cii' => self::APPLICATION_VND_ANSER_WEB_CERTIFICATE_ISSUE_INITIATION,
1899: 'cil' => self::APPLICATION_VND_MS_ARTGALRY,
1900: 'cla' => self::APPLICATION_VND_CLAYMORE,
1901: 'class' => self::APPLICATION_JAVA_VM,
1902: 'clkk' => self::APPLICATION_VND_CRICK_CLICKER_KEYBOARD,
1903: 'clkp' => self::APPLICATION_VND_CRICK_CLICKER_PALETTE,
1904: 'clkt' => self::APPLICATION_VND_CRICK_CLICKER_TEMPLATE,
1905: 'clkw' => self::APPLICATION_VND_CRICK_CLICKER_WORDBANK,
1906: 'clkx' => self::APPLICATION_VND_CRICK_CLICKER,
1907: 'clp' => self::APPLICATION_X_MSCLIP,
1908: 'cmc' => self::APPLICATION_VND_COSMOCALLER,
1909: 'cmdf' => self::CHEMICAL_X_CMDF,
1910: 'cml' => self::CHEMICAL_X_CML,
1911: 'cmp' => self::APPLICATION_VND_YELLOWRIVER_CUSTOM_MENU,
1912: 'cmx' => self::IMAGE_X_CMX,
1913: 'cod' => self::APPLICATION_VND_RIM_COD,
1914: 'cpio' => self::APPLICATION_X_CPIO,
1915: 'cpt' => self::APPLICATION_MAC_COMPACTPRO,
1916: 'crd' => self::APPLICATION_X_MSCARDFILE,
1917: 'crl' => self::APPLICATION_PKIX_CRL,
1918: 'cryptonote' => self::APPLICATION_VND_RIG_CRYPTONOTE,
1919: 'csh' => self::APPLICATION_X_CSH,
1920: 'csml' => self::CHEMICAL_X_CSML,
1921: 'csp' => self::APPLICATION_VND_COMMONSPACE,
1922: 'css' => self::TEXT_CSS,
1923: 'csv' => self::TEXT_CSV,
1924: 'cu' => self::APPLICATION_CU_SEEME,
1925: 'curl' => self::TEXT_VND_CURL,
1926: 'cww' => self::APPLICATION_PRS_CWW,
1927: 'dae' => self::MODEL_VND_COLLADA_XML,
1928: 'daf' => self::APPLICATION_VND_MOBIUS_DAF,
1929: 'dar' => self::APPLICATION_X_DAR,
1930: 'davmount' => self::APPLICATION_DAVMOUNT_XML,
1931: 'dcurl' => self::TEXT_VND_CURL_DCURL,
1932: 'dd2' => self::APPLICATION_VND_OMA_DD2_XML,
1933: 'ddd' => self::APPLICATION_VND_FUJIXEROX_DDD,
1934: 'deb' => self::APPLICATION_X_DEBIAN_PACKAGE,
1935: 'der' => self::APPLICATION_X_X509_CA_CERT,
1936: 'dfac' => self::APPLICATION_VND_DREAMFACTORY,
1937: 'dgc' => self::APPLICATION_X_DGC_COMPRESSED,
1938: 'dir' => self::APPLICATION_X_DIRECTOR,
1939: 'dis' => self::APPLICATION_VND_MOBIUS_DIS,
1940: 'djvu' => self::IMAGE_VND_DJVU,
1941: 'dmg' => self::APPLICATION_X_APPLE_DISKIMAGE,
1942: 'dna' => self::APPLICATION_VND_DNA,
1943: 'doc' => self::APPLICATION_MSWORD,
1944: 'docm' => self::APPLICATION_VND_MS_WORD_DOCUMENT_MACROENABLED_12,
1945: 'docx' => self::APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT,
1946: 'dotm' => self::APPLICATION_VND_MS_WORD_TEMPLATE_MACROENABLED_12,
1947: 'dotx' => self::APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_TEMPLATE,
1948: 'dp' => self::APPLICATION_VND_OSGI_DP,
1949: 'dpg' => self::APPLICATION_VND_DPGRAPH,
1950: 'dra' => self::AUDIO_VND_DRA,
1951: 'dsc' => self::TEXT_PRS_LINES_TAG,
1952: 'dssc' => self::APPLICATION_DSSC_DER,
1953: 'dtb' => self::APPLICATION_X_DTBOOK_XML,
1954: 'dtd' => self::APPLICATION_XML_DTD,
1955: 'dts' => self::AUDIO_VND_DTS,
1956: 'dtshd' => self::AUDIO_VND_DTS_HD,
1957: 'dvi' => self::APPLICATION_X_DVI,
1958: 'dwf' => self::MODEL_VND_DWF,
1959: 'dwg' => self::IMAGE_VND_DWG,
1960: 'dxf' => self::IMAGE_VND_DXF,
1961: 'dxp' => self::APPLICATION_VND_SPOTFIRE_DXP,
1962: 'ecelp4800' => self::AUDIO_VND_NUERA_ECELP4800,
1963: 'ecelp7470' => self::AUDIO_VND_NUERA_ECELP7470,
1964: 'ecelp9600' => self::AUDIO_VND_NUERA_ECELP9600,
1965: 'edm' => self::APPLICATION_VND_NOVADIGM_EDM,
1966: 'edx' => self::APPLICATION_VND_NOVADIGM_EDX,
1967: 'efif' => self::APPLICATION_VND_PICSEL,
1968: 'ei6' => self::APPLICATION_VND_PG_OSASLI,
1969: 'eml' => self::MESSAGE_RFC822,
1970: 'emma' => self::APPLICATION_EMMA_XML,
1971: 'eol' => self::AUDIO_VND_DIGITAL_WINDS,
1972: 'eot' => self::APPLICATION_VND_MS_FONTOBJECT,
1973: 'epub' => self::APPLICATION_EPUB_ZIP,
1974: 'es' => self::APPLICATION_ECMASCRIPT,
1975: 'es3' => self::APPLICATION_VND_ESZIGNO3_XML,
1976: 'esf' => self::APPLICATION_VND_EPSON_ESF,
1977: 'etx' => self::TEXT_X_SETEXT,
1978: 'exe' => self::APPLICATION_X_MSDOWNLOAD,
1979: 'exi' => self::APPLICATION_EXI,
1980: 'ext' => self::APPLICATION_VND_NOVADIGM_EXT,
1981: 'ez2' => self::APPLICATION_VND_EZPIX_ALBUM,
1982: 'ez3' => self::APPLICATION_VND_EZPIX_PACKAGE,
1983: 'f' => self::TEXT_X_FORTRAN,
1984: 'f4v' => self::VIDEO_X_F4V,
1985: 'fbs' => self::IMAGE_VND_FASTBIDSHEET,
1986: 'fcs' => self::APPLICATION_VND_ISAC_FCS,
1987: 'fdf' => self::APPLICATION_VND_FDF,
1988: 'fe_launch' => self::APPLICATION_VND_DENOVO_FCSELAYOUT_LINK,
1989: 'fg5' => self::APPLICATION_VND_FUJITSU_OASYSGP,
1990: 'fh' => self::IMAGE_X_FREEHAND,
1991: 'fig' => self::APPLICATION_X_XFIG,
1992: 'fli' => self::VIDEO_X_FLI,
1993: 'flo' => self::APPLICATION_VND_MICROGRAFX_FLO,
1994: 'flv' => self::VIDEO_X_FLV,
1995: 'flw' => self::APPLICATION_VND_KDE_KIVIO,
1996: 'flx' => self::TEXT_VND_FMI_FLEXSTOR,
1997: 'fly' => self::TEXT_VND_FLY,
1998: 'fm' => self::APPLICATION_VND_FRAMEMAKER,
1999: 'fnc' => self::APPLICATION_VND_FROGANS_FNC,
2000: 'fpx' => self::IMAGE_VND_FPX,
2001: 'fsc' => self::APPLICATION_VND_FSC_WEBLAUNCH,
2002: 'fst' => self::IMAGE_VND_FST,
2003: 'ftc' => self::APPLICATION_VND_FLUXTIME_CLIP,
2004: 'fti' => self::APPLICATION_VND_ANSER_WEB_FUNDS_TRANSFER_INITIATION,
2005: 'fvt' => self::VIDEO_VND_FVT,
2006: 'fxp' => self::APPLICATION_VND_ADOBE_FXP,
2007: 'fzs' => self::APPLICATION_VND_FUZZYSHEET,
2008: 'g2w' => self::APPLICATION_VND_GEOPLAN,
2009: 'g3' => self::IMAGE_G3FAX,
2010: 'g3w' => self::APPLICATION_VND_GEOSPACE,
2011: 'gac' => self::APPLICATION_VND_GROOVE_ACCOUNT,
2012: 'gca' => self::APPLICATION_X_GCA_COMPRESSED,
2013: 'gdl' => self::MODEL_VND_GDL,
2014: 'geo' => self::APPLICATION_VND_DYNAGEO,
2015: 'gex' => self::APPLICATION_VND_GEOMETRY_EXPLORER,
2016: 'ggb' => self::APPLICATION_VND_GEOGEBRA_FILE,
2017: 'ggt' => self::APPLICATION_VND_GEOGEBRA_TOOL,
2018: 'ghf' => self::APPLICATION_VND_GROOVE_HELP,
2019: 'gif' => self::IMAGE_GIF,
2020: 'gim' => self::APPLICATION_VND_GROOVE_IDENTITY_MESSAGE,
2021: 'gmx' => self::APPLICATION_VND_GMX,
2022: 'gnumeric' => self::APPLICATION_X_GNUMERIC,
2023: 'gph' => self::APPLICATION_VND_FLOGRAPHIT,
2024: 'gqf' => self::APPLICATION_VND_GRAFEQ,
2025: 'gram' => self::APPLICATION_SRGS,
2026: 'grv' => self::APPLICATION_VND_GROOVE_INJECTOR,
2027: 'grxml' => self::APPLICATION_SRGS_XML,
2028: 'gsf' => self::APPLICATION_X_FONT_GHOSTSCRIPT,
2029: 'gtar' => self::APPLICATION_X_GTAR,
2030: 'gtm' => self::APPLICATION_VND_GROOVE_TOOL_MESSAGE,
2031: 'gtw' => self::MODEL_VND_GTW,
2032: 'gv' => self::TEXT_VND_GRAPHVIZ,
2033: 'gxt' => self::APPLICATION_VND_GEONEXT,
2034: 'h261' => self::VIDEO_H261,
2035: 'h263' => self::VIDEO_H263,
2036: 'h264' => self::VIDEO_H264,
2037: 'hal' => self::APPLICATION_VND_HAL_XML,
2038: 'hbci' => self::APPLICATION_VND_HBCI,
2039: 'hdf' => self::APPLICATION_X_HDF,
2040: 'hlp' => self::APPLICATION_WINHLP,
2041: 'hpgl' => self::APPLICATION_VND_HP_HPGL,
2042: 'hpid' => self::APPLICATION_VND_HP_HPID,
2043: 'hps' => self::APPLICATION_VND_HP_HPS,
2044: 'hqx' => self::APPLICATION_MAC_BINHEX40,
2045: 'htke' => self::APPLICATION_VND_KENAMEAAPP,
2046: 'html' => self::TEXT_HTML,
2047: 'hvd' => self::APPLICATION_VND_YAMAHA_HV_DIC,
2048: 'hvp' => self::APPLICATION_VND_YAMAHA_HV_VOICE,
2049: 'hvs' => self::APPLICATION_VND_YAMAHA_HV_SCRIPT,
2050: 'i2g' => self::APPLICATION_VND_INTERGEO,
2051: 'icc' => self::APPLICATION_VND_ICCPROFILE,
2052: 'ice' => self::X_CONFERENCE_X_COOLTALK,
2053: 'ico' => self::IMAGE_X_ICON,
2054: 'ics' => self::TEXT_CALENDAR,
2055: 'ief' => self::IMAGE_IEF,
2056: 'ifm' => self::APPLICATION_VND_SHANA_INFORMED_FORMDATA,
2057: 'igl' => self::APPLICATION_VND_IGLOADER,
2058: 'igm' => self::APPLICATION_VND_INSORS_IGM,
2059: 'igs' => self::MODEL_IGES,
2060: 'igx' => self::APPLICATION_VND_MICROGRAFX_IGX,
2061: 'iif' => self::APPLICATION_VND_SHANA_INFORMED_INTERCHANGE,
2062: 'imp' => self::APPLICATION_VND_ACCPAC_SIMPLY_IMP,
2063: 'ims' => self::APPLICATION_VND_MS_IMS,
2064: 'ipfix' => self::APPLICATION_IPFIX,
2065: 'ipk' => self::APPLICATION_VND_SHANA_INFORMED_PACKAGE,
2066: 'irm' => self::APPLICATION_VND_IBM_RIGHTS_MANAGEMENT,
2067: 'irp' => self::APPLICATION_VND_IREPOSITORY_PACKAGE_XML,
2068: 'itp' => self::APPLICATION_VND_SHANA_INFORMED_FORMTEMPLATE,
2069: 'ivp' => self::APPLICATION_VND_IMMERVISION_IVP,
2070: 'ivu' => self::APPLICATION_VND_IMMERVISION_IVU,
2071: 'jad' => self::TEXT_VND_SUN_J2ME_APP_DESCRIPTOR,
2072: 'jam' => self::APPLICATION_VND_JAM,
2073: 'jar' => self::APPLICATION_JAVA_ARCHIVE,
2074: 'java' => self::TEXT_X_JAVA_SOURCE_JAVA,
2075: 'jisp' => self::APPLICATION_VND_JISP,
2076: 'jlt' => self::APPLICATION_VND_HP_JLYT,
2077: 'jnlp' => self::APPLICATION_X_JAVA_JNLP_FILE,
2078: 'joda' => self::APPLICATION_VND_JOOST_JODA_ARCHIVE,
2079: 'jpg' => self::IMAGE_JPEG,
2080: 'jpeg' => self::IMAGE_JPEG,
2081: 'jpgv' => self::VIDEO_JPEG,
2082: 'jpm' => self::VIDEO_JPM,
2083: 'js' => self::APPLICATION_JAVASCRIPT,
2084: 'json' => self::APPLICATION_JSON,
2085: 'karbon' => self::APPLICATION_VND_KDE_KARBON,
2086: 'kfo' => self::APPLICATION_VND_KDE_KFORMULA,
2087: 'kia' => self::APPLICATION_VND_KIDSPIRATION,
2088: 'kml' => self::APPLICATION_VND_GOOGLE_EARTH_KML_XML,
2089: 'kmz' => self::APPLICATION_VND_GOOGLE_EARTH_KMZ,
2090: 'kne' => self::APPLICATION_VND_KINAR,
2091: 'kon' => self::APPLICATION_VND_KDE_KONTOUR,
2092: 'kpr' => self::APPLICATION_VND_KDE_KPRESENTER,
2093: 'ksp' => self::APPLICATION_VND_KDE_KSPREAD,
2094: 'ktx' => self::IMAGE_KTX,
2095: 'ktz' => self::APPLICATION_VND_KAHOOTZ,
2096: 'kwd' => self::APPLICATION_VND_KDE_KWORD,
2097: 'lasxml' => self::APPLICATION_VND_LAS_LAS_XML,
2098: 'latex' => self::APPLICATION_X_LATEX,
2099: 'lbd' => self::APPLICATION_VND_LLAMAGRAPHICS_LIFE_BALANCE_DESKTOP,
2100: 'lbe' => self::APPLICATION_VND_LLAMAGRAPHICS_LIFE_BALANCE_EXCHANGE_XML,
2101: 'les' => self::APPLICATION_VND_HHE_LESSON_PLAYER,
2102: 'link66' => self::APPLICATION_VND_ROUTE66_LINK66_XML,
2103: 'lrm' => self::APPLICATION_VND_MS_LRM,
2104: 'ltf' => self::APPLICATION_VND_FROGANS_LTF,
2105: 'lvp' => self::AUDIO_VND_LUCENT_VOICE,
2106: 'lwp' => self::APPLICATION_VND_LOTUS_WORDPRO,
2107: 'lz' => self::APPLICATION_X_LZIP,
2108: 'lzh' => self::APPLICATION_X_LZH,
2109: 'lzma' => self::APPLICATION_X_LZMA,
2110: 'lzo' => self::APPLICATION_X_LZOP,
2111: 'lzx' => self::APPLICATION_X_LZX,
2112: 'm21' => self::APPLICATION_MP21,
2113: 'm3u' => self::AUDIO_X_MPEGURL,
2114: 'm3u8' => self::APPLICATION_VND_APPLE_MPEGURL,
2115: 'm4v' => self::VIDEO_X_M4V,
2116: 'ma' => self::APPLICATION_MATHEMATICA,
2117: 'mads' => self::APPLICATION_MADS_XML,
2118: 'mag' => self::APPLICATION_VND_ECOWIN_CHART,
2119: 'mathml' => self::APPLICATION_MATHML_XML,
2120: 'mbk' => self::APPLICATION_VND_MOBIUS_MBK,
2121: 'mbox' => self::APPLICATION_MBOX,
2122: 'mc1' => self::APPLICATION_VND_MEDCALCDATA,
2123: 'mcd' => self::APPLICATION_VND_MCD,
2124: 'mcurl' => self::TEXT_VND_CURL_MCURL,
2125: 'mdb' => self::APPLICATION_X_MSACCESS,
2126: 'mdi' => self::IMAGE_VND_MS_MODI,
2127: 'meta4' => self::APPLICATION_METALINK4_XML,
2128: 'mets' => self::APPLICATION_METS_XML,
2129: 'mfm' => self::APPLICATION_VND_MFMP,
2130: 'mgp' => self::APPLICATION_VND_OSGEO_MAPGUIDE_PACKAGE,
2131: 'mgz' => self::APPLICATION_VND_PROTEUS_MAGAZINE,
2132: 'mid' => self::AUDIO_MIDI,
2133: 'mif' => self::APPLICATION_VND_MIF,
2134: 'mj2' => self::VIDEO_MJ2,
2135: 'mlp' => self::APPLICATION_VND_DOLBY_MLP,
2136: 'mmd' => self::APPLICATION_VND_CHIPNUTS_KARAOKE_MMD,
2137: 'mmf' => self::APPLICATION_VND_SMAF,
2138: 'mmr' => self::IMAGE_VND_FUJIXEROX_EDMICS_MMR,
2139: 'mny' => self::APPLICATION_X_MSMONEY,
2140: 'mods' => self::APPLICATION_MODS_XML,
2141: 'movie' => self::VIDEO_X_SGI_MOVIE,
2142: 'mp4' => self::VIDEO_MP4,
2143: 'mp4a' => self::AUDIO_MP4,
2144: 'mpc' => self::APPLICATION_VND_MOPHUN_CERTIFICATE,
2145: 'mpeg' => self::VIDEO_MPEG,
2146: 'mpga' => self::AUDIO_MPEG,
2147: 'mpkg' => self::APPLICATION_VND_APPLE_INSTALLER_XML,
2148: 'mpm' => self::APPLICATION_VND_BLUEICE_MULTIPASS,
2149: 'mpn' => self::APPLICATION_VND_MOPHUN_APPLICATION,
2150: 'mpp' => self::APPLICATION_VND_MS_PROJECT,
2151: 'mpy' => self::APPLICATION_VND_IBM_MINIPAY,
2152: 'mqy' => self::APPLICATION_VND_MOBIUS_MQY,
2153: 'mrc' => self::APPLICATION_MARC,
2154: 'mrcx' => self::APPLICATION_MARCXML_XML,
2155: 'mscml' => self::APPLICATION_MEDIASERVERCONTROL_XML,
2156: 'mseq' => self::APPLICATION_VND_MSEQ,
2157: 'msf' => self::APPLICATION_VND_EPSON_MSF,
2158: 'msh' => self::MODEL_MESH,
2159: 'msl' => self::APPLICATION_VND_MOBIUS_MSL,
2160: 'msty' => self::APPLICATION_VND_MUVEE_STYLE,
2161: 'mts' => self::MODEL_VND_MTS,
2162: 'mus' => self::APPLICATION_VND_MUSICIAN,
2163: 'musicxml' => self::APPLICATION_VND_RECORDARE_MUSICXML_XML,
2164: 'mvb' => self::APPLICATION_X_MSMEDIAVIEW,
2165: 'mwf' => self::APPLICATION_VND_MFER,
2166: 'mxf' => self::APPLICATION_MXF,
2167: 'mxl' => self::APPLICATION_VND_RECORDARE_MUSICXML,
2168: 'mxml' => self::APPLICATION_XV_XML,
2169: 'mxs' => self::APPLICATION_VND_TRISCAPE_MXS,
2170: 'mxu' => self::VIDEO_VND_MPEGURL,
2171: 'n3' => self::TEXT_N3,
2172: 'n_gage' => self::APPLICATION_VND_NOKIA_N_GAGE_SYMBIAN_INSTALL,
2173: 'nbp' => self::APPLICATION_VND_WOLFRAM_PLAYER,
2174: 'nc' => self::APPLICATION_X_NETCDF,
2175: 'ncx' => self::APPLICATION_X_DTBNCX_XML,
2176: 'ngdat' => self::APPLICATION_VND_NOKIA_N_GAGE_DATA,
2177: 'nlu' => self::APPLICATION_VND_NEUROLANGUAGE_NLU,
2178: 'nml' => self::APPLICATION_VND_ENLIVEN,
2179: 'nnd' => self::APPLICATION_VND_NOBLENET_DIRECTORY,
2180: 'nns' => self::APPLICATION_VND_NOBLENET_SEALER,
2181: 'nnw' => self::APPLICATION_VND_NOBLENET_WEB,
2182: 'npx' => self::IMAGE_VND_NET_FPX,
2183: 'nsf' => self::APPLICATION_VND_LOTUS_NOTES,
2184: 'oa2' => self::APPLICATION_VND_FUJITSU_OASYS2,
2185: 'oa3' => self::APPLICATION_VND_FUJITSU_OASYS3,
2186: 'oas' => self::APPLICATION_VND_FUJITSU_OASYS,
2187: 'obd' => self::APPLICATION_X_MSBINDER,
2188: 'oda' => self::APPLICATION_ODA,
2189: 'odb' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_DATABASE,
2190: 'odc' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_CHART,
2191: 'odf' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_FORMULA,
2192: 'odft' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE,
2193: 'odg' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_GRAPHICS,
2194: 'odi' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_IMAGE,
2195: 'odm' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT_MASTER,
2196: 'odp' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_PRESENTATION,
2197: 'ods' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_SPREADSHEET,
2198: 'odt' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT,
2199: 'oga' => self::AUDIO_OGG,
2200: 'ogv' => self::VIDEO_OGG,
2201: 'ogx' => self::APPLICATION_OGG,
2202: 'onetoc' => self::APPLICATION_ONENOTE,
2203: 'opf' => self::APPLICATION_OEBPS_PACKAGE_XML,
2204: 'org' => self::APPLICATION_VND_LOTUS_ORGANIZER,
2205: 'osf' => self::APPLICATION_VND_YAMAHA_OPENSCOREFORMAT,
2206: 'osfpvg' => self::APPLICATION_VND_YAMAHA_OPENSCOREFORMAT_OSFPVG_XML,
2207: 'otc' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_CHART_TEMPLATE,
2208: 'otf' => self::APPLICATION_X_FONT_OTF,
2209: 'otg' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_GRAPHICS_TEMPLATE,
2210: 'oth' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT_WEB,
2211: 'oti' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_IMAGE_TEMPLATE,
2212: 'otp' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE,
2213: 'ots' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE,
2214: 'ott' => self::APPLICATION_VND_OASIS_OPENDOCUMENT_TEXT_TEMPLATE,
2215: 'oxt' => self::APPLICATION_VND_OPENOFFICEORG_EXTENSION,
2216: 'p' => self::TEXT_X_PASCAL,
2217: 'p10' => self::APPLICATION_PKCS10,
2218: 'p12' => self::APPLICATION_X_PKCS12,
2219: 'p7b' => self::APPLICATION_X_PKCS7_CERTIFICATES,
2220: 'p7m' => self::APPLICATION_PKCS7_MIME,
2221: 'p7r' => self::APPLICATION_X_PKCS7_CERTREQRESP,
2222: 'p7s' => self::APPLICATION_PKCS7_SIGNATURE,
2223: 'p8' => self::APPLICATION_PKCS8,
2224: 'par' => self::TEXT_PLAIN_BAS,
2225: 'paw' => self::APPLICATION_VND_PAWAAFILE,
2226: 'pbd' => self::APPLICATION_VND_POWERBUILDER6,
2227: 'pbm' => self::IMAGE_X_PORTABLE_BITMAP,
2228: 'pcf' => self::APPLICATION_X_FONT_PCF,
2229: 'pcl' => self::APPLICATION_VND_HP_PCL,
2230: 'pclxl' => self::APPLICATION_VND_HP_PCLXL,
2231: 'pcurl' => self::APPLICATION_VND_CURL_PCURL,
2232: 'pcx' => self::IMAGE_X_PCX,
2233: 'pdb' => self::APPLICATION_VND_PALM,
2234: 'pdf' => self::APPLICATION_PDF,
2235: 'pfa' => self::APPLICATION_X_FONT_TYPE1,
2236: 'pfr' => self::APPLICATION_FONT_TDPFR,
2237: 'pgm' => self::IMAGE_X_PORTABLE_GRAYMAP,
2238: 'pgn' => self::APPLICATION_X_CHESS_PGN,
2239: 'pgp' => self::APPLICATION_PGP_SIGNATURE,
2240: 'pic' => self::IMAGE_X_PICT,
2241: 'pjpeg' => self::IMAGE_PJPEG,
2242: 'pki' => self::APPLICATION_PKIXCMP,
2243: 'pkipath' => self::APPLICATION_PKIX_PKIPATH,
2244: 'plb' => self::APPLICATION_VND_3GPP_PIC_BW_LARGE,
2245: 'plc' => self::APPLICATION_VND_MOBIUS_PLC,
2246: 'plf' => self::APPLICATION_VND_POCKETLEARN,
2247: 'pls' => self::APPLICATION_PLS_XML,
2248: 'pml' => self::APPLICATION_VND_CTC_POSML,
2249: 'png' => self::IMAGE_PNG,
2250: 'pnm' => self::IMAGE_X_PORTABLE_ANYMAP,
2251: 'portpkg' => self::APPLICATION_VND_MACPORTS_PORTPKG,
2252: 'potm' => self::APPLICATION_VND_MS_POWERPOINT_TEMPLATE_MACROENABLED_12,
2253: 'potx' => self::APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_TEMPLATE,
2254: 'ppam' => self::APPLICATION_VND_MS_POWERPOINT_ADDIN_MACROENABLED_12,
2255: 'ppd' => self::APPLICATION_VND_CUPS_PPD,
2256: 'ppm' => self::IMAGE_X_PORTABLE_PIXMAP,
2257: 'ppsm' => self::APPLICATION_VND_MS_POWERPOINT_SLIDESHOW_MACROENABLED_12,
2258: 'ppsx' => self::APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_SLIDESHOW,
2259: 'ppt' => self::APPLICATION_VND_MS_POWERPOINT,
2260: 'pptm' => self::APPLICATION_VND_MS_POWERPOINT_PRESENTATION_MACROENABLED_12,
2261: 'pptx' => self::APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_PRESENTATION,
2262: 'prc' => self::APPLICATION_X_MOBIPOCKET_EBOOK,
2263: 'pre' => self::APPLICATION_VND_LOTUS_FREELANCE,
2264: 'prf' => self::APPLICATION_PICS_RULES,
2265: 'psb' => self::APPLICATION_VND_3GPP_PIC_BW_SMALL,
2266: 'psd' => self::IMAGE_VND_ADOBE_PHOTOSHOP,
2267: 'psf' => self::APPLICATION_X_FONT_LINUX_PSF,
2268: 'pskcxml' => self::APPLICATION_PSKC_XML,
2269: 'ptid' => self::APPLICATION_VND_PVI_PTID1,
2270: 'pub' => self::APPLICATION_X_MSPUBLISHER,
2271: 'pvb' => self::APPLICATION_VND_3GPP_PIC_BW_VAR,
2272: 'pwn' => self::APPLICATION_VND_3M_POST_IT_NOTES,
2273: 'pya' => self::AUDIO_VND_MS_PLAYREADY_MEDIA_PYA,
2274: 'pyv' => self::VIDEO_VND_MS_PLAYREADY_MEDIA_PYV,
2275: 'qam' => self::APPLICATION_VND_EPSON_QUICKANIME,
2276: 'qbo' => self::APPLICATION_VND_INTU_QBO,
2277: 'qfx' => self::APPLICATION_VND_INTU_QFX,
2278: 'qps' => self::APPLICATION_VND_PUBLISHARE_DELTA_TREE,
2279: 'qt' => self::VIDEO_QUICKTIME,
2280: 'qxd' => self::APPLICATION_VND_QUARK_QUARKXPRESS,
2281: 'ram' => self::AUDIO_X_PN_REALAUDIO,
2282: 'rar' => self::APPLICATION_X_RAR_COMPRESSED,
2283: 'ras' => self::IMAGE_X_CMU_RASTER,
2284: 'rcprofile' => self::APPLICATION_VND_IPUNPLUGGED_RCPROFILE,
2285: 'rdf' => self::APPLICATION_RDF_XML,
2286: 'rdz' => self::APPLICATION_VND_DATA_VISION_RDZ,
2287: 'rep' => self::APPLICATION_VND_BUSINESSOBJECTS,
2288: 'res' => self::APPLICATION_X_DTBRESOURCE_XML,
2289: 'rgb' => self::IMAGE_X_RGB,
2290: 'rif' => self::APPLICATION_REGINFO_XML,
2291: 'rip' => self::AUDIO_VND_RIP,
2292: 'rl' => self::APPLICATION_RESOURCE_LISTS_XML,
2293: 'rlc' => self::IMAGE_VND_FUJIXEROX_EDMICS_RLC,
2294: 'rld' => self::APPLICATION_RESOURCE_LISTS_DIFF_XML,
2295: 'rm' => self::APPLICATION_VND_RN_REALMEDIA,
2296: 'rmp' => self::AUDIO_X_PN_REALAUDIO_PLUGIN,
2297: 'rms' => self::APPLICATION_VND_JCP_JAVAME_MIDLET_RMS,
2298: 'rnc' => self::APPLICATION_RELAX_NG_COMPACT_SYNTAX,
2299: 'rp9' => self::APPLICATION_VND_CLOANTO_RP9,
2300: 'rpss' => self::APPLICATION_VND_NOKIA_RADIO_PRESETS,
2301: 'rpst' => self::APPLICATION_VND_NOKIA_RADIO_PRESET,
2302: 'rq' => self::APPLICATION_SPARQL_QUERY,
2303: 'rs' => self::APPLICATION_RLS_SERVICES_XML,
2304: 'rsd' => self::APPLICATION_RSD_XML,
2305: 'rss' => self::APPLICATION_RSS_XML,
2306: 'rtf' => self::APPLICATION_RTF,
2307: 'rtx' => self::TEXT_RICHTEXT,
2308: 's' => self::TEXT_X_ASM,
2309: 'saf' => self::APPLICATION_VND_YAMAHA_SMAF_AUDIO,
2310: 'sbml' => self::APPLICATION_SBML_XML,
2311: 'sc' => self::APPLICATION_VND_IBM_SECURE_CONTAINER,
2312: 'scd' => self::APPLICATION_X_MSSCHEDULE,
2313: 'scm' => self::APPLICATION_VND_LOTUS_SCREENCAM,
2314: 'scq' => self::APPLICATION_SCVP_CV_REQUEST,
2315: 'scs' => self::APPLICATION_SCVP_CV_RESPONSE,
2316: 'scurl' => self::TEXT_VND_CURL_SCURL,
2317: 'sda' => self::APPLICATION_VND_STARDIVISION_DRAW,
2318: 'sdc' => self::APPLICATION_VND_STARDIVISION_CALC,
2319: 'sdd' => self::APPLICATION_VND_STARDIVISION_IMPRESS,
2320: 'sdkm' => self::APPLICATION_VND_SOLENT_SDKM_XML,
2321: 'sdp' => self::APPLICATION_SDP,
2322: 'sdw' => self::APPLICATION_VND_STARDIVISION_WRITER,
2323: 'see' => self::APPLICATION_VND_SEEMAIL,
2324: 'seed' => self::APPLICATION_VND_FDSN_SEED,
2325: 'sema' => self::APPLICATION_VND_SEMA,
2326: 'semd' => self::APPLICATION_VND_SEMD,
2327: 'semf' => self::APPLICATION_VND_SEMF,
2328: 'ser' => self::APPLICATION_JAVA_SERIALIZED_OBJECT,
2329: 'setpay' => self::APPLICATION_SET_PAYMENT_INITIATION,
2330: 'setreg' => self::APPLICATION_SET_REGISTRATION_INITIATION,
2331: 'sfd_hdstx' => self::APPLICATION_VND_HYDROSTATIX_SOF_DATA,
2332: 'sfs' => self::APPLICATION_VND_SPOTFIRE_SFS,
2333: 'sgl' => self::APPLICATION_VND_STARDIVISION_WRITER_GLOBAL,
2334: 'sgml' => self::TEXT_SGML,
2335: 'sh' => self::APPLICATION_X_SH,
2336: 'shar' => self::APPLICATION_X_SHAR,
2337: 'shf' => self::APPLICATION_SHF_XML,
2338: 'sis' => self::APPLICATION_VND_SYMBIAN_INSTALL,
2339: 'sit' => self::APPLICATION_X_STUFFIT,
2340: 'sitx' => self::APPLICATION_X_STUFFITX,
2341: 'skp' => self::APPLICATION_VND_KOAN,
2342: 'sldm' => self::APPLICATION_VND_MS_POWERPOINT_SLIDE_MACROENABLED_12,
2343: 'sldx' => self::APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_SLIDE,
2344: 'slt' => self::APPLICATION_VND_EPSON_SALT,
2345: 'sm' => self::APPLICATION_VND_STEPMANIA_STEPCHART,
2346: 'smf' => self::APPLICATION_VND_STARDIVISION_MATH,
2347: 'smi' => self::APPLICATION_SMIL_XML,
2348: 'snf' => self::APPLICATION_X_FONT_SNF,
2349: 'spf' => self::APPLICATION_VND_YAMAHA_SMAF_PHRASE,
2350: 'spl' => self::APPLICATION_X_FUTURESPLASH,
2351: 'spot' => self::TEXT_VND_IN3D_SPOT,
2352: 'spp' => self::APPLICATION_SCVP_VP_RESPONSE,
2353: 'spq' => self::APPLICATION_SCVP_VP_REQUEST,
2354: 'src' => self::APPLICATION_X_WAIS_SOURCE,
2355: 'sru' => self::APPLICATION_SRU_XML,
2356: 'srx' => self::APPLICATION_SPARQL_RESULTS_XML,
2357: 'sse' => self::APPLICATION_VND_KODAK_DESCRIPTOR,
2358: 'ssf' => self::APPLICATION_VND_EPSON_SSF,
2359: 'ssml' => self::APPLICATION_SSML_XML,
2360: 'st' => self::APPLICATION_VND_SAILINGTRACKER_TRACK,
2361: 'stc' => self::APPLICATION_VND_SUN_XML_CALC_TEMPLATE,
2362: 'std' => self::APPLICATION_VND_SUN_XML_DRAW_TEMPLATE,
2363: 'stf' => self::APPLICATION_VND_WT_STF,
2364: 'sti' => self::APPLICATION_VND_SUN_XML_IMPRESS_TEMPLATE,
2365: 'stk' => self::APPLICATION_HYPERSTUDIO,
2366: 'stl' => self::APPLICATION_VND_MS_PKI_STL,
2367: 'str' => self::APPLICATION_VND_PG_FORMAT,
2368: 'stw' => self::APPLICATION_VND_SUN_XML_WRITER_TEMPLATE,
2369: 'sub' => self::IMAGE_VND_DVB_SUBTITLE,
2370: 'sus' => self::APPLICATION_VND_SUS_CALENDAR,
2371: 'sv4cpio' => self::APPLICATION_X_SV4CPIO,
2372: 'sv4crc' => self::APPLICATION_X_SV4CRC,
2373: 'svc' => self::APPLICATION_VND_DVB_SERVICE,
2374: 'svd' => self::APPLICATION_VND_SVD,
2375: 'svg' => self::IMAGE_SVG_XML,
2376: 'swf' => self::APPLICATION_X_SHOCKWAVE_FLASH,
2377: 'swi' => self::APPLICATION_VND_ARISTANETWORKS_SWI,
2378: 'sxc' => self::APPLICATION_VND_SUN_XML_CALC,
2379: 'sxd' => self::APPLICATION_VND_SUN_XML_DRAW,
2380: 'sxg' => self::APPLICATION_VND_SUN_XML_WRITER_GLOBAL,
2381: 'sxi' => self::APPLICATION_VND_SUN_XML_IMPRESS,
2382: 'sxm' => self::APPLICATION_VND_SUN_XML_MATH,
2383: 'sxw' => self::APPLICATION_VND_SUN_XML_WRITER,
2384: 'sz' => self::APPLICATION_X_SNAPPY_FRAMED,
2385: 't' => self::TEXT_TROFF,
2386: 'tao' => self::APPLICATION_VND_TAO_INTENT_MODULE_ARCHIVE,
2387: 'tar' => self::APPLICATION_X_TAR,
2388: 'tcap' => self::APPLICATION_VND_3GPP2_TCAP,
2389: 'tcl' => self::APPLICATION_X_TCL,
2390: 'teacher' => self::APPLICATION_VND_SMART_TEACHER,
2391: 'tei' => self::APPLICATION_TEI_XML,
2392: 'tex' => self::APPLICATION_X_TEX,
2393: 'texinfo' => self::APPLICATION_X_TEXINFO,
2394: 'tfi' => self::APPLICATION_THRAUD_XML,
2395: 'tfm' => self::APPLICATION_X_TEX_TFM,
2396: 'thmx' => self::APPLICATION_VND_MS_OFFICETHEME,
2397: 'tiff' => self::IMAGE_TIFF,
2398: 'tmo' => self::APPLICATION_VND_TMOBILE_LIVETV,
2399: 'torrent' => self::APPLICATION_X_BITTORRENT,
2400: 'tpl' => self::APPLICATION_VND_GROOVE_TOOL_TEMPLATE,
2401: 'tpt' => self::APPLICATION_VND_TRID_TPT,
2402: 'tra' => self::APPLICATION_VND_TRUEAPP,
2403: 'trm' => self::APPLICATION_X_MSTERMINAL,
2404: 'tsd' => self::APPLICATION_TIMESTAMPED_DATA,
2405: 'tsv' => self::TEXT_TAB_SEPARATED_VALUES,
2406: 'ttf' => self::APPLICATION_X_FONT_TTF,
2407: 'ttl' => self::TEXT_TURTLE,
2408: 'twd' => self::APPLICATION_VND_SIMTECH_MINDMAPPER,
2409: 'txd' => self::APPLICATION_VND_GENOMATIX_TUXEDO,
2410: 'txf' => self::APPLICATION_VND_MOBIUS_TXF,
2411: 'txt' => self::TEXT_PLAIN,
2412: 'ufd' => self::APPLICATION_VND_UFDL,
2413: 'umj' => self::APPLICATION_VND_UMAJIN,
2414: 'unityweb' => self::APPLICATION_VND_UNITY,
2415: 'uoml' => self::APPLICATION_VND_UOML_XML,
2416: 'uri' => self::TEXT_URI_LIST,
2417: 'ustar' => self::APPLICATION_X_USTAR,
2418: 'utz' => self::APPLICATION_VND_UIQ_THEME,
2419: 'uu' => self::TEXT_X_UUENCODE,
2420: 'uva' => self::AUDIO_VND_DECE_AUDIO,
2421: 'uvh' => self::VIDEO_VND_DECE_HD,
2422: 'uvi' => self::IMAGE_VND_DECE_GRAPHIC,
2423: 'uvm' => self::VIDEO_VND_DECE_MOBILE,
2424: 'uvp' => self::VIDEO_VND_DECE_PD,
2425: 'uvs' => self::VIDEO_VND_DECE_SD,
2426: 'uvu' => self::VIDEO_VND_UVVU_MP4,
2427: 'uvv' => self::VIDEO_VND_DECE_VIDEO,
2428: 'vcd' => self::APPLICATION_X_CDLINK,
2429: 'vcf' => self::TEXT_X_VCARD,
2430: 'vcg' => self::APPLICATION_VND_GROOVE_VCARD,
2431: 'vcs' => self::TEXT_X_VCALENDAR,
2432: 'vcx' => self::APPLICATION_VND_VCX,
2433: 'vis' => self::APPLICATION_VND_VISIONARY,
2434: 'viv' => self::VIDEO_VND_VIVO,
2435: 'vsd' => self::APPLICATION_VND_VISIO,
2436: 'vsdx' => self::APPLICATION_VND_VISIO2013,
2437: 'vsf' => self::APPLICATION_VND_VSF,
2438: 'vtu' => self::MODEL_VND_VTU,
2439: 'vxml' => self::APPLICATION_VOICEXML_XML,
2440: 'wad' => self::APPLICATION_X_DOOM,
2441: 'wav' => self::AUDIO_X_WAV,
2442: 'wax' => self::AUDIO_X_MS_WAX,
2443: 'wbmp' => self::IMAGE_VND_WAP_WBMP,
2444: 'wbs' => self::APPLICATION_VND_CRITICALTOOLS_WBS_XML,
2445: 'wbxml' => self::APPLICATION_VND_WAP_WBXML,
2446: 'weba' => self::AUDIO_WEBM,
2447: 'webm' => self::VIDEO_WEBM,
2448: 'webp' => self::IMAGE_WEBP,
2449: 'wg' => self::APPLICATION_VND_PMI_WIDGET,
2450: 'wgt' => self::APPLICATION_WIDGET,
2451: 'wm' => self::VIDEO_X_MS_WM,
2452: 'wma' => self::AUDIO_X_MS_WMA,
2453: 'wmd' => self::APPLICATION_X_MS_WMD,
2454: 'wmf' => self::APPLICATION_X_MSMETAFILE,
2455: 'wml' => self::TEXT_VND_WAP_WML,
2456: 'wmlc' => self::APPLICATION_VND_WAP_WMLC,
2457: 'wmls' => self::TEXT_VND_WAP_WMLSCRIPT,
2458: 'wmlsc' => self::APPLICATION_VND_WAP_WMLSCRIPTC,
2459: 'wmv' => self::VIDEO_X_MS_WMV,
2460: 'wmx' => self::VIDEO_X_MS_WMX,
2461: 'wmz' => self::APPLICATION_X_MS_WMZ,
2462: 'woff' => self::APPLICATION_X_FONT_WOFF,
2463: 'wpd' => self::APPLICATION_VND_WORDPERFECT,
2464: 'wpl' => self::APPLICATION_VND_MS_WPL,
2465: 'wps' => self::APPLICATION_VND_MS_WORKS,
2466: 'wqd' => self::APPLICATION_VND_WQD,
2467: 'wri' => self::APPLICATION_X_MSWRITE,
2468: 'wrl' => self::MODEL_VRML,
2469: 'wsdl' => self::APPLICATION_WSDL_XML,
2470: 'wspolicy' => self::APPLICATION_WSPOLICY_XML,
2471: 'wtb' => self::APPLICATION_VND_WEBTURBO,
2472: 'wvx' => self::VIDEO_X_MS_WVX,
2473: 'x3d' => self::APPLICATION_VND_HZN_3D_CROSSWORD,
2474: 'xap' => self::APPLICATION_X_SILVERLIGHT_APP,
2475: 'xar' => self::APPLICATION_VND_XARA,
2476: 'xbap' => self::APPLICATION_X_MS_XBAP,
2477: 'xbd' => self::APPLICATION_VND_FUJIXEROX_DOCUWORKS_BINDER,
2478: 'xbm' => self::IMAGE_X_XBITMAP,
2479: 'xdf' => self::APPLICATION_XCAP_DIFF_XML,
2480: 'xdm' => self::APPLICATION_VND_SYNCML_DM_XML,
2481: 'xdp' => self::APPLICATION_VND_ADOBE_XDP_XML,
2482: 'xdssc' => self::APPLICATION_DSSC_XML,
2483: 'xdw' => self::APPLICATION_VND_FUJIXEROX_DOCUWORKS,
2484: 'xenc' => self::APPLICATION_XENC_XML,
2485: 'xer' => self::APPLICATION_PATCH_OPS_ERROR_XML,
2486: 'xfdf' => self::APPLICATION_VND_ADOBE_XFDF,
2487: 'xfdl' => self::APPLICATION_VND_XFDL,
2488: 'xhtml' => self::APPLICATION_XHTML_XML,
2489: 'xif' => self::IMAGE_VND_XIFF,
2490: 'xlam' => self::APPLICATION_VND_MS_EXCEL_ADDIN_MACROENABLED_12,
2491: 'xls' => self::APPLICATION_VND_MS_EXCEL,
2492: 'xlsb' => self::APPLICATION_VND_MS_EXCEL_SHEET_BINARY_MACROENABLED_12,
2493: 'xlsm' => self::APPLICATION_VND_MS_EXCEL_SHEET_MACROENABLED_12,
2494: 'xlsx' => self::APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET,
2495: 'xltm' => self::APPLICATION_VND_MS_EXCEL_TEMPLATE_MACROENABLED_12,
2496: 'xltx' => self::APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_TEMPLATE,
2497: 'xml' => self::APPLICATION_XML,
2498: 'xo' => self::APPLICATION_VND_OLPC_SUGAR,
2499: 'xop' => self::APPLICATION_XOP_XML,
2500: 'xpi' => self::APPLICATION_X_XPINSTALL,
2501: 'xpm' => self::IMAGE_X_XPIXMAP,
2502: 'xpr' => self::APPLICATION_VND_IS_XPR,
2503: 'xps' => self::APPLICATION_VND_MS_XPSDOCUMENT,
2504: 'xpw' => self::APPLICATION_VND_INTERCON_FORMNET,
2505: 'xslt' => self::APPLICATION_XSLT_XML,
2506: 'xsm' => self::APPLICATION_VND_SYNCML_XML,
2507: 'xspf' => self::APPLICATION_XSPF_XML,
2508: 'xul' => self::APPLICATION_VND_MOZILLA_XUL_XML,
2509: 'xwd' => self::IMAGE_X_XWINDOWDUMP,
2510: 'xyz' => self::CHEMICAL_X_XYZ,
2511: 'xz' => self::APPLICATION_X_XZ,
2512: 'yaml' => self::TEXT_YAML,
2513: 'yang' => self::APPLICATION_YANG,
2514: 'yin' => self::APPLICATION_YIN_XML,
2515: 'z' => self::APPLICATION_X_COMPRESS,
2516: 'zaz' => self::APPLICATION_VND_ZZAZZ_DECK_XML,
2517: 'zip' => self::APPLICATION_ZIP,
2518: 'zir' => self::APPLICATION_VND_ZUL,
2519: 'zmm' => self::APPLICATION_VND_HANDHELD_ENTERTAINMENT_XML,
2520: 'zoo' => self::APPLICATION_X_ZOO,
2521: ];
2522:
2523: /** @var bool[] */
2524: private static $compressed = [
2525: self::APPLICATION_GZIP => true,
2526: self::APPLICATION_X_BZIP => true,
2527: self::APPLICATION_X_BZIP2 => true,
2528: self::APPLICATION_X_COMPRESS => true,
2529: self::APPLICATION_X_LZIP => true,
2530: self::APPLICATION_X_LZMA => true,
2531: self::APPLICATION_X_LZOP => true,
2532: self::APPLICATION_X_SNAPPY_FRAMED => true,
2533: self::APPLICATION_X_XZ => true,
2534: ];
2535:
2536: /** @var bool[] */
2537: private static $archive = [
2538: // uncompressed
2539: self::APPLICATION_VND_EFI_ISO => false,
2540: self::APPLICATION_X_CPIO => false,
2541: self::APPLICATION_X_SV4CPIO => false,
2542: self::APPLICATION_X_SHAR => false,
2543: self::APPLICATION_X_TAR => false,
2544:
2545: // compressed
2546: self::APPLICATION_VND_ANDROID_PACKAGE_ARCHIVE => true,
2547: self::APPLICATION_VND_MS_CAB_COMPRESSED => true,
2548: self::APPLICATION_X_7Z_COMPRESSED => true,
2549: self::APPLICATION_X_ACE_COMPRESSED => true,
2550: self::APPLICATION_X_ASTROTITE_AFA => true,
2551: self::APPLICATION_X_ALZ_COMPRESSED => true,
2552: self::APPLICATION_X_ARJ => true,
2553: self::APPLICATION_X_B1 => true,
2554: self::APPLICATION_X_CFS_COMPRESSED => true,
2555: self::APPLICATION_X_DAR => true,
2556: self::APPLICATION_X_DGC_COMPRESSED => true,
2557: self::APPLICATION_X_APPLE_DISKIMAGE => true,
2558: self::APPLICATION_X_GCA_COMPRESSED => true,
2559: self::APPLICATION_X_GTAR => true,
2560: self::APPLICATION_X_LZH => true,
2561: self::APPLICATION_X_LZX => true,
2562: self::APPLICATION_X_RAR_COMPRESSED => true,
2563: self::APPLICATION_X_STUFFIT => true,
2564: self::APPLICATION_X_STUFFITX => true,
2565: self::APPLICATION_X_ZOO => true,
2566: self::APPLICATION_ZIP => true,
2567: ];
2568:
2569: public static function getValueRegexp(): string
2570: {
2571: return BaseContentType::getValueRegexp() . '\\/[0-9a-z.+-]+';
2572: }
2573:
2574: /**
2575: * @param string $extension
2576: * @return self|null
2577: */
2578: public static function findByExtension(string $extension): ?self
2579: {
2580: if (isset(self::$extensions[$extension])) {
2581: return self::get(self::$extensions[$extension]);
2582: } else {
2583: return null;
2584: }
2585: }
2586:
2587: public function getBaseType(): BaseContentType
2588: {
2589: return BaseContentType::get(Str::toFirst($this->getValue(), '/'));
2590: }
2591:
2592: public function getExtension(): ?string
2593: {
2594: return array_search($this->getValue(), self::$extensions) ?: null;
2595: }
2596:
2597: public function isAudio(): bool
2598: {
2599: return Str::toFirst($this->getValue(), '/') === BaseContentType::AUDIO;
2600: }
2601:
2602: public function isArchive(): bool
2603: {
2604: return isset(self::$archive[$this->getValue()]);
2605: }
2606:
2607: public function isCompressed(): bool
2608: {
2609: return isset(self::$compressed[$this->getValue()]);
2610: }
2611:
2612: public function isCsv(): bool
2613: {
2614: return $this->getValue() === self::TEXT_CSV;
2615: }
2616:
2617: public function isFont(): bool
2618: {
2619: return Str::toFirst($this->getValue(), '/') === BaseContentType::FONT;
2620: }
2621:
2622: public function isHtml(): bool
2623: {
2624: return Str::contains(Str::fromFirst($this->getValue(), '/'), 'html');
2625: }
2626:
2627: public function isImage(): bool
2628: {
2629: return Str::toFirst($this->getValue(), '/') === BaseContentType::IMAGE;
2630: }
2631:
2632: public function isJson(): bool
2633: {
2634: return Str::contains(Str::fromFirst($this->getValue(), '/'), 'json');
2635: }
2636:
2637: public function isPdf(): bool
2638: {
2639: return $this->getValue() === self::APPLICATION_PDF;
2640: }
2641:
2642: public function isText(): bool
2643: {
2644: return Str::toFirst($this->getValue(), '/') === BaseContentType::TEXT;
2645: }
2646:
2647: public function isVideo(): bool
2648: {
2649: return Str::toFirst($this->getValue(), '/') === BaseContentType::VIDEO;
2650: }
2651:
2652: public function isXml(): bool
2653: {
2654: return Str::contains(Str::fromFirst($this->getValue(), '/'), 'xml');
2655: }
2656:
2657: }
| 0 % | Io\ContentType\ContentTypeDetector.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io\ContentType;
11:
12: use Dogma\Io\Path;
13: use Dogma\Language\Encoding;
14:
15: class ContentTypeDetector
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var string|null */
20: private $magicFile;
21:
22: /** @var resource */
23: private $typeHandler;
24:
25: /** @var resource */
26: private $encodingHandler;
27:
28: public function __construct(?string $magicFile = null)
29: {
30: $this->magicFile = $magicFile;
31: }
32:
33: private function initTypeHandler(): void
34: {
35: error_clear_last();
36: $typeHandler = finfo_open(FILEINFO_MIME_TYPE, $this->magicFile);
37: if ($typeHandler === false) {
38: throw new \Dogma\Io\ContentType\ContentTypeDetectionException('Cannot initialize finfo extension.', error_get_last());
39: }
40: $this->typeHandler = $typeHandler;
41: }
42:
43: private function initEncodingHandler(): void
44: {
45: error_clear_last();
46: $encodingHandler = finfo_open(FILEINFO_MIME_ENCODING, $this->magicFile);
47: if ($encodingHandler === false) {
48: throw new \Dogma\Io\ContentType\ContentTypeDetectionException('Cannot initialize finfo extension.', error_get_last());
49: }
50: $this->encodingHandler = $encodingHandler;
51: }
52:
53: /**
54: * @param string|\Dogma\Io\Path $file
55: * @return \Dogma\Io\ContentType\ContentType|null
56: */
57: public function detectFileContentType($file): ?ContentType
58: {
59: if ($this->typeHandler === null) {
60: $this->initTypeHandler();
61: }
62:
63: $path = $file instanceof Path ? $file->getPath() : $file;
64: $type = finfo_file($this->typeHandler, $path);
65:
66: return ContentType::get($type);
67: }
68:
69: /**
70: * @param string|\Dogma\Io\Path $string
71: * @return \Dogma\Io\ContentType\ContentType|null
72: */
73: public function detectStringContentType(string $string): ?ContentType
74: {
75: if ($this->typeHandler === null) {
76: $this->initTypeHandler();
77: }
78:
79: $type = finfo_buffer($this->typeHandler, $string);
80:
81: return ContentType::get($type);
82: }
83:
84: /**
85: * @param string|\Dogma\Io\Path $file
86: * @return \Dogma\Language\Encoding|null
87: */
88: public function detectFileEncoding($file): ?Encoding
89: {
90: if ($this->encodingHandler === null) {
91: $this->initEncodingHandler();
92: }
93:
94: $path = $file instanceof Path ? $file->getPath() : $file;
95: $type = finfo_file($this->encodingHandler, $path);
96:
97: return Encoding::get($type);
98: }
99:
100: /**
101: * @param string|\Dogma\Io\Path $string
102: * @return \Dogma\Language\Encoding|null
103: */
104: public function detectStringEncoding(string $string): ?Encoding
105: {
106: if ($this->encodingHandler === null) {
107: $this->initEncodingHandler();
108: }
109:
110: $type = finfo_buffer($this->encodingHandler, $string);
111:
112: return Encoding::get($type);
113: }
114:
115: }
| 0 % | Io\ContentType\exceptions\ContentTypeDetectionException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io\ContentType;
11:
12: class ContentTypeDetectionException extends \Dogma\Exception
13: {
14:
15: }
| 0 % | Io\exceptions\FileException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io;
11:
12: class FileException extends \Dogma\Io\IoException
13: {
14:
15: /** @var mixed[]|null */
16: private $error;
17:
18: /**
19: * @param string $message
20: * @param mixed[]|null $error
21: * @param \Throwable|null $previous
22: */
23: public function __construct(string $message, ?array $error = null, ?\Throwable $previous = null)
24: {
25: parent::__construct($message, $previous);
26:
27: $this->error = $error;
28: }
29:
30: /**
31: * @return mixed[]|null
32: */
33: public function getError(): ?array
34: {
35: return $this->error;
36: }
37:
38: }
| 0 % | Io\exceptions\IoException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io;
11:
12: /**
13: * Filesystem or stream exception
14: */
15: class IoException extends \Dogma\Exception
16: {
17:
18: }
| 0 % | Io\exceptions\StreamException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io;
11:
12: class StreamException extends \Dogma\Io\IoException
13: {
14:
15: }
| 0 % | Io\File.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: // spell-check-ignore: maxmemory
11:
12: namespace Dogma\Io;
13:
14: use Dogma\Io\Filesystem\FileInfo;
15: use Dogma\ResourceType;
16:
17: /**
18: * Binary file reader/writer
19: */
20: class File implements \Dogma\Io\Path
21: {
22: use \Dogma\StrictBehaviorMixin;
23: use \Dogma\NonCloneableMixin;
24: use \Dogma\NonSerializableMixin;
25:
26: /** @var int */
27: public static $defaultChunkSize = 8192;
28:
29: /** @var string */
30: protected $path;
31:
32: /** @var string */
33: protected $mode;
34:
35: /** @var resource|null */
36: protected $streamContext;
37:
38: /** @var resource|null */
39: protected $handle;
40:
41: /** @var \Dogma\Io\FileMetaData|null */
42: private $metaData;
43:
44: /**
45: * @param string|resource|\Dogma\Io\FilePath|\Dogma\Io\Filesystem\FileInfo $file
46: * @param string $mode
47: * @param resource|null $streamContext
48: */
49: public function __construct($file, string $mode = FileMode::OPEN_READ, $streamContext = null)
50: {
51: if (is_resource($file) && get_resource_type($file) === ResourceType::STREAM) {
52: $this->handle = $file;
53: $this->mode = $mode;
54: return;
55: } elseif (is_string($file)) {
56: $this->path = $file;
57: } elseif ($file instanceof FilePath || $file instanceof FileInfo) {
58: $this->path = $file->getPath();
59: } else {
60: throw new \Dogma\InvalidArgumentException('Argument $file must be a file path or a stream resource.');
61: }
62:
63: $this->mode = $mode;
64: $this->streamContext = $streamContext;
65:
66: if ($this->handle === null) {
67: $this->open();
68: }
69: }
70:
71: public function __destruct()
72: {
73: if ($this->handle !== null) {
74: $this->close();
75: }
76: }
77:
78: public static function createTemporaryFile(string $dir, string $prefix = ''): self
79: {
80: if (!is_dir($dir)) {
81: throw new \Dogma\Io\FileException(sprintf('Invalid directory path: "%s".', $dir));
82: }
83: error_clear_last();
84: $name = tempnam($dir, $prefix);
85:
86: if ($name === false) {
87: throw new \Dogma\Io\FileException('Cannot create a temporary file.', error_get_last());
88: }
89:
90: return new static($name, FileMode::OPEN_READ_WRITE);
91: }
92:
93: public static function createMemoryFile(?int $maxSize = null): self
94: {
95: if ($maxSize === null) {
96: return new static('php://memory', FileMode::CREATE_OR_TRUNCATE_READ_WRITE);
97: } else {
98: return new static(sprintf('php://temp/maxmemory:%d', $maxSize), FileMode::CREATE_OR_TRUNCATE_READ_WRITE);
99: }
100: }
101:
102: public function toTextFile(): TextFile
103: {
104: return new TextFile($this->handle, $this->mode, $this->streamContext);
105: }
106:
107: /**
108: * @return resource|null
109: */
110: public function getHandle()
111: {
112: return $this->handle;
113: }
114:
115: public function getMode(): string
116: {
117: return $this->mode;
118: }
119:
120: public function getPath(): string
121: {
122: if (empty($this->path)) {
123: $meta = $this->getStreamMetaData();
124: $this->path = str_replace('\\', '/', $meta['uri']);
125: }
126:
127: return $this->path;
128: }
129:
130: public function getName(): string
131: {
132: return basename($this->getPath());
133: }
134:
135: public function move(string $path): void
136: {
137: $path = str_replace('\\', '/', $path);
138: $destination = dirname($path);
139: if (!is_dir($destination)) {
140: throw new \Dogma\Io\FileException(sprintf('Directory %s is not writable.', $destination));
141: }
142: $currentPath = $this->getPath();
143:
144: $this->close();
145: $result = rename($currentPath, $path);
146: if ($result === false) {
147: throw new \Dogma\Io\FileException(sprintf('Cannot move file \'%s\' to \'%s\'.', $this->getPath(), $path));
148: }
149: chmod($destination, 0666);
150:
151: $this->path = $path;
152: $this->open();
153: }
154:
155: public function remove(): void
156: {
157: $this->close();
158: $result = unlink($this->path);
159: if ($result === false) {
160: throw new \Dogma\Io\FileException(sprintf('Cannot remove file \'%s\'.', $this->getPath()));
161: }
162: }
163:
164: public function isOpen(): bool
165: {
166: return (bool) $this->handle;
167: }
168:
169: public function open(): void
170: {
171: error_clear_last();
172: if ($this->streamContext !== null) {
173: $handle = fopen($this->path, $this->mode, false, $this->streamContext);
174: } else {
175: $handle = fopen($this->path, $this->mode, false);
176: }
177: if ($handle === false) {
178: throw new \Dogma\Io\FileException(sprintf('Cannot open file in mode \'%s\'.', $this->mode), error_get_last());
179: }
180: $this->handle = $handle;
181: }
182:
183: public function close(): void
184: {
185: $this->checkOpened();
186:
187: error_clear_last();
188: $result = fclose($this->handle);
189:
190: if ($result === false) {
191: throw new \Dogma\Io\FileException('Cannot close file.', error_get_last());
192: }
193: $this->metaData = null;
194: $this->handle = null;
195: }
196:
197: public function endOfFileReached(): bool
198: {
199: $this->checkOpened();
200:
201: error_clear_last();
202: $feof = feof($this->handle);
203:
204: if ($feof === true) {
205: $error = error_get_last();
206: if ($error !== null) {
207: throw new \Dogma\Io\FileException('File interrupted.', $error);
208: }
209: }
210:
211: return $feof;
212: }
213:
214: public function read(?int $length = null): string
215: {
216: $this->checkOpened();
217:
218: if (empty($length)) {
219: $length = self::$defaultChunkSize;
220: }
221:
222: error_clear_last();
223: $data = fread($this->handle, $length);
224:
225: if ($data === false) {
226: if ($this->endOfFileReached()) {
227: throw new \Dogma\Io\FileException('Cannot read data from file. End of file was reached.', error_get_last());
228: } else {
229: throw new \Dogma\Io\FileException('Cannot read data from file.', error_get_last());
230: }
231: }
232:
233: return $data;
234: }
235:
236: /**
237: * Copy range of data to another File or callback. Returns actual length of copied data.
238: * @param \Dogma\Io\File|callable $destination
239: * @param int|null $start
240: * @param int $length
241: * @param int|null $chunkSize
242: * @return int
243: */
244: public function copyData($destination, ?int $start = null, int $length = 0, ?int $chunkSize = null): int
245: {
246: if (empty($chunkSize)) {
247: $chunkSize = self::$defaultChunkSize;
248: }
249: if (!empty($start)) {
250: $this->setPosition($start);
251: }
252:
253: $done = 0;
254: $chunk = $length ? min($length - $done, $chunkSize) : $chunkSize;
255: while (!$this->endOfFileReached() && (!$length || $done < $length)) {
256: $buff = $this->read($chunk);
257: $done += strlen($buff);
258:
259: if ($destination instanceof File) {
260: $destination->write($buff);
261:
262: } elseif (is_callable($destination)) {
263: call_user_func($destination, $buff);
264:
265: } else {
266: throw new \Dogma\InvalidArgumentException('Destination must be File or callable!');
267: }
268: }
269:
270: return $done;
271: }
272:
273: public function getContent(): string
274: {
275: if ($this->getPosition()) {
276: $this->setPosition(0);
277: }
278:
279: $result = '';
280: while (!$this->endOfFileReached()) {
281: $result .= $this->read();
282: }
283:
284: return $result;
285: }
286:
287: public function write(string $data): void
288: {
289: $this->checkOpened();
290:
291: error_clear_last();
292: $result = fwrite($this->handle, $data);
293:
294: if ($result === false) {
295: throw new \Dogma\Io\FileException('Cannot write data to file.', error_get_last());
296: }
297: }
298:
299: /**
300: * Truncate file and move pointer at the end
301: * @param int $size
302: */
303: public function truncate(int $size = 0): void
304: {
305: $this->checkOpened();
306:
307: error_clear_last();
308: $result = ftruncate($this->handle, $size);
309:
310: if ($result === false) {
311: throw new \Dogma\Io\FileException('Cannot truncate file.', error_get_last());
312: }
313:
314: $this->setPosition($size);
315: }
316:
317: /**
318: * Flush the file output buffer (fsync)
319: */
320: public function flush(): void
321: {
322: $this->checkOpened();
323:
324: error_clear_last();
325: $result = fflush($this->handle);
326:
327: if ($result === false) {
328: throw new \Dogma\Io\FileException('Cannot flush file cache.', error_get_last());
329: }
330: $this->metaData = null;
331: }
332:
333: public function lock(?LockType $mode = null): void
334: {
335: $this->checkOpened();
336:
337: if ($mode === null) {
338: $mode = LockType::get(LockType::SHARED);
339: }
340:
341: error_clear_last();
342: $wouldBlock = null;
343: $result = flock($this->handle, $mode->getValue(), $wouldBlock);
344:
345: if ($result === false) {
346: if ($wouldBlock) {
347: throw new \Dogma\Io\FileException('Non-blocking lock cannot be acquired.', error_get_last());
348: } else {
349: throw new \Dogma\Io\FileException('Cannot lock file.', error_get_last());
350: }
351: }
352: }
353:
354: public function unlock(): void
355: {
356: $this->checkOpened();
357:
358: error_clear_last();
359: $result = flock($this->handle, LOCK_UN);
360:
361: if ($result === false) {
362: throw new \Dogma\Io\FileException('Cannot unlock file.', error_get_last());
363: }
364: }
365:
366: /**
367: * @param int $position
368: * @param \Dogma\Io\Position|null $from
369: */
370: public function setPosition(int $position, ?Position $from = null): void
371: {
372: $this->checkOpened();
373:
374: if ($position < 0) {
375: $position *= -1;
376: $from = Position::get(Position::END);
377: }
378: if ($from === null) {
379: $from = Position::get(Position::BEGINNING);
380: }
381:
382: error_clear_last();
383: $result = fseek($this->handle, $position, $from);
384:
385: if ($result !== 0) {
386: throw new \Dogma\Io\FileException('Cannot set file pointer position.', error_get_last());
387: }
388: }
389:
390: public function getPosition(): int
391: {
392: $this->checkOpened();
393:
394: error_clear_last();
395: $position = ftell($this->handle);
396:
397: if ($position === false) {
398: throw new \Dogma\Io\FileException('Cannot get file pointer position.', error_get_last());
399: }
400:
401: return $position;
402: }
403:
404: public function getMetaData(): FileMetaData
405: {
406: if (!$this->metaData) {
407: if ($this->handle) {
408: error_clear_last();
409: $stat = fstat($this->handle);
410: if (!$stat) {
411: throw new \Dogma\Io\FileException('Cannot acquire file metadata.', error_get_last());
412: }
413: $this->metaData = new FileMetaData($stat);
414: } else {
415: if (empty($this->path)) {
416: $this->getPath();
417: }
418: $this->metaData = FileMetaData::get($this->path);
419: }
420: }
421:
422: return $this->metaData;
423: }
424:
425: /**
426: * Get stream meta data for files opened via HTTP, FTP…
427: * @return mixed[]
428: */
429: public function getStreamMetaData(): array
430: {
431: return stream_get_meta_data($this->handle);
432: }
433:
434: /**
435: * Get stream wrapper headers (HTTP)
436: * @return mixed[]
437: */
438: public function getHeaders(): array
439: {
440: $data = stream_get_meta_data($this->handle);
441:
442: return $data['wrapper_data'];
443: }
444:
445: /*
446: [
447: [wrapper_data] => [
448: [0] => HTTP/1.1 200 OK
449: [1] => Server: Apache/2.2.3 (Red Hat)
450: [2] => Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT
451: [3] => ETag: "b300b4-1b6-4059a80bfd280"
452: [4] => Accept-Ranges: bytes
453: [5] => Content-Type: text/html; charset=UTF-8
454: [6] => Set-Cookie: FOO=BAR; expires=Fri, 21-Dec-2012 12:00:00 GMT; path=/; domain=.example.com
455: [6] => Connection: close
456: [7] => Date: Fri, 16 Oct 2009 12:00:00 GMT
457: [8] => Age: 1164
458: [9] => Content-Length: 438
459: ]
460: [wrapper_type] => http
461: [stream_type] => tcp_socket/ssl
462: [mode] => r
463: [unread_bytes] => 438
464: [seekable] =>
465: [uri] => http://www.example.com/
466: [timed_out] =>
467: [blocked] => 1
468: [eof] =>
469: ]
470: */
471:
472: private function checkOpened(): void
473: {
474: if ($this->handle === null) {
475: throw new \Dogma\Io\FileException('File is already closed.');
476: }
477: }
478:
479: }
| 0 % | Io\FileMetaData.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: // spell-check-ignore: ino nlinks uid gid rdev atime mtime ctime blksize
11:
12: namespace Dogma\Io;
13:
14: class FileMetaData
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var int[]|string[] */
19: private $stat;
20:
21: /**
22: * @param int[]|string[] $stat
23: */
24: public function __construct(array $stat)
25: {
26: $this->stat = $stat;
27: }
28:
29: public static function get(string $path): self
30: {
31: error_clear_last();
32: $stat = stat($path);
33:
34: if ($stat === false) {
35: throw new \Dogma\Io\FileException('Cannot acquire file metadata.', error_get_last());
36: }
37:
38: return new self($stat);
39: }
40:
41: public function getDeviceId(): int
42: {
43: return $this->stat['dev'];
44: }
45:
46: public function getInode(): int
47: {
48: return $this->stat['ino'];
49: }
50:
51: public function getPermissions(): int
52: {
53: return $this->stat['mode'];
54: }
55:
56: public function getLinksCount(): int
57: {
58: return $this->stat['nlinks'];
59: }
60:
61: public function getOwner(): int
62: {
63: return $this->stat['uid'];
64: }
65:
66: public function getGroup(): int
67: {
68: return $this->stat['gid'];
69: }
70:
71: public function getDeviceType(): string
72: {
73: return $this->stat['rdev'];
74: }
75:
76: public function getSize(): int
77: {
78: return $this->stat['size'];
79: }
80:
81: public function getAccessTime(): int
82: {
83: return $this->stat['atime'];
84: }
85:
86: public function getModifyTime(): int
87: {
88: return $this->stat['mtime'];
89: }
90:
91: public function getInodeChangeTime(): int
92: {
93: return $this->stat['ctime'];
94: }
95:
96: public function getBlockSize(): int
97: {
98: return $this->stat['blksize'];
99: }
100:
101: public function getBlocks(): int
102: {
103: return $this->stat['blocks'];
104: }
105:
106: }
| 0 % | Io\FileMode.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: // spell-check-ignore: xb cb
11:
12: namespace Dogma\Io;
13:
14: class FileMode
15: {
16: use \Dogma\StaticClassMixin;
17:
18: // if not found: ERROR; keep content
19: public const OPEN_READ = 'rb';
20: public const OPEN_READ_WRITE = 'r+b';
21:
22: // if found: ERROR; no content
23: public const CREATE_WRITE = 'xb';
24: public const CREATE_READ_WRITE = 'x+b';
25:
26: // if not found: create; keep content
27: public const CREATE_OR_OPEN_WRITE = 'cb';
28: public const CREATE_OR_OPEN_READ_WRITE = 'c+b';
29:
30: // if not found: create; truncate content
31: public const CREATE_OR_TRUNCATE_WRITE = 'wb';
32: public const CREATE_OR_TRUNCATE_READ_WRITE = 'w+b';
33:
34: // if not found: create; keep content, point to end of file, don't accept new position
35: public const CREATE_OR_APPEND_WRITE = 'ab';
36: public const CREATE_OR_APPEND_READ_WRITE = 'a+b';
37:
38: }
| 0 % | Io\FilePath.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io;
11:
12: class FilePath implements \Dogma\Io\Path
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var string */
17: private $path;
18:
19: public function __construct(string $path)
20: {
21: $this->path = str_replace('\\', '/', $path);
22: }
23:
24: public function getPath(): string
25: {
26: return $this->path;
27: }
28:
29: public function getName(): string
30: {
31: return basename($this->path);
32: }
33:
34: }
| 0 % | Io\Filesystem\DirectoryIterator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io\Filesystem;
11:
12: use FilesystemIterator;
13:
14: class DirectoryIterator extends \FilesystemIterator
15: {
16:
17: /** @var int|null */
18: private $flags;
19:
20: public function __construct(string $path, ?int $flags = null)
21: {
22: if (isset($flags)) {
23: $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS;
24: }
25:
26: $this->flags = $flags;
27: try {
28: if ($flags & FilesystemIterator::CURRENT_AS_FILEINFO) {
29: parent::__construct($path, $flags | FilesystemIterator::CURRENT_AS_PATHNAME);
30: } else {
31: parent::__construct($path, $flags);
32: }
33: } catch (\UnexpectedValueException $e) {
34: throw new \Dogma\Io\Filesystem\DirectoryException($e->getMessage(), $e);
35: }
36: }
37:
38: /**
39: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
40: * @param int|null $flags
41: */
42: public function setFlags($flags = null): void
43: {
44: $this->flags = $flags;
45: if ($flags & FilesystemIterator::CURRENT_AS_FILEINFO) {
46: parent::setFlags($flags | FilesystemIterator::CURRENT_AS_PATHNAME);
47: } else {
48: parent::setFlags($flags);
49: }
50: }
51:
52: /**
53: * @return \Dogma\Io\Filesystem\FileInfo|mixed
54: */
55: public function current()
56: {
57: if ($this->flags & FilesystemIterator::CURRENT_AS_FILEINFO) {
58: return new FileInfo(parent::current());
59: }
60: return parent::current();
61: }
62:
63: }
| 0 % | Io\Filesystem\exceptions\DirectoryException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io\Filesystem;
11:
12: class DirectoryException extends \Dogma\Io\IoException
13: {
14:
15: }
| 0 % | Io\Filesystem\FileInfo.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io\Filesystem;
11:
12: use Dogma\Io\File;
13: use Dogma\Io\FileMode;
14:
15: /**
16: * File Info
17: */
18: class FileInfo extends \SplFileInfo implements \Dogma\Io\Path
19: {
20: use \Dogma\StrictBehaviorMixin;
21:
22: /* inherits:
23: getATime()
24: getBasename()
25: getCTime()
26: getExtension()
27: getFileInfo()
28: getFilename()
29: getGroup()
30: getInode()
31: getLinkTarget()
32: getMTime()
33: getOwner()
34: getPath()
35: getPathInfo()
36: getPathname()
37: getPerms()
38: getRealPath()
39: getSize()
40: getType()
41: isDir()
42: isExecutable()
43: isFile()
44: isLink()
45: isReadable()
46: isWritable()
47: openFile() ***
48: setFileClass() ???
49: setInfoClass() ok
50: __toString() ???
51: */
52:
53: public function getPath(): string
54: {
55: return str_replace('\\', '/', parent::getPath());
56: }
57:
58: public function getName(): string
59: {
60: return basename($this->getPath());
61: }
62:
63: /**
64: * @param string $mode
65: * @param resource|null $streamContext
66: * @return \Dogma\Io\File
67: */
68: public function open(string $mode = FileMode::OPEN_READ, $streamContext = null): File
69: {
70: return new File($this->getRealPath(), $mode, $streamContext);
71: }
72:
73: /**
74: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
75: * @param string $mode
76: * @param string|null $includePath
77: * @param resource|null $streamContext
78: * @return \Dogma\Io\File
79: */
80: public function openFile($mode = FileMode::OPEN_READ, $includePath = null, $streamContext = null): File
81: {
82: /// include path!
83: return $this->open($mode, $streamContext);
84: }
85:
86: /**
87: * Is current or parent directory
88: */
89: public function isDot(): bool
90: {
91: return $this->getFilename() === '.' | $this->getFilename() === '..';
92: }
93:
94: }
| 0 % | Io\Filesystem\RecursiveDirectoryIterator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io\Filesystem;
11:
12: use FilesystemIterator;
13:
14: class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
15: {
16:
17: /** @var int */
18: private $flags;
19:
20: public function __construct(string $path, ?int $flags = null)
21: {
22: if (isset($flags)) {
23: $flags = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS;
24: }
25:
26: $this->flags = $flags;
27: try {
28: if ($flags & FilesystemIterator::CURRENT_AS_FILEINFO) {
29: parent::__construct($path, $flags | FilesystemIterator::CURRENT_AS_PATHNAME);
30: } else {
31: parent::__construct($path, $flags);
32: }
33: } catch (\UnexpectedValueException $e) {
34: throw new \Dogma\Io\Filesystem\DirectoryException($e->getMessage(), $e);
35: }
36: }
37:
38: /**
39: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
40: * @param int|null $flags
41: */
42: public function setFlags($flags = null): void
43: {
44: $this->flags = $flags;
45: if ($flags & FilesystemIterator::CURRENT_AS_FILEINFO) {
46: parent::setFlags($flags | FilesystemIterator::CURRENT_AS_PATHNAME);
47: } else {
48: parent::setFlags($flags);
49: }
50: }
51:
52: /**
53: * @return \Dogma\Io\Filesystem\FileInfo|mixed
54: */
55: public function current()
56: {
57: if ($this->flags & FilesystemIterator::CURRENT_AS_FILEINFO) {
58: return new FileInfo(parent::current());
59: }
60: return parent::current();
61: }
62:
63: }
| 0 % | Io\LineEndings.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io;
11:
12: class LineEndings extends \Dogma\Enum\StringEnum
13: {
14:
15: public const UNIX = "\n";
16: public const WINDOWS = "\r\n";
17: public const MAC = "\r";
18:
19: }
| 0 % | Io\LockType.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io;
11:
12: class LockType extends \Dogma\Enum\IntEnum
13: {
14:
15: public const SHARED = LOCK_SH;
16: public const EXCLUSIVE = LOCK_EX;
17: public const NON_BLOCKING = LOCK_NB;
18:
19: }
| 0 % | Io\Path.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io;
11:
12: interface Path
13: {
14:
15: /**
16: * Fully qualified path with name
17: */
18: public function getPath(): string;
19:
20: /**
21: * File name without path
22: */
23: public function getName(): string;
24:
25: }
| 0 % | Io\Position.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io;
11:
12: class Position extends \Dogma\Enum\IntEnum
13: {
14:
15: public const BEGINNING = SEEK_SET;
16: public const CURRENT = SEEK_CUR;
17: public const END = SEEK_END;
18:
19: }
| 0 % | Io\TextFile.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Io;
11:
12: use Dogma\Language\Encoding;
13:
14: /**
15: * Text file reader/writer
16: */
17: class TextFile extends \Dogma\Io\File
18: {
19:
20: /** @var string */
21: private $internalEncoding = Encoding::UTF_8;
22:
23: /** @var string */
24: private $encoding = Encoding::UTF_8;
25:
26: /** @var string */
27: private $nl = LineEndings::UNIX;
28:
29: /**
30: * @param string|resource $file
31: * @param string $mode
32: * @param resource|null $streamContext
33: * @param \Dogma\Language\Encoding $encoding
34: * @param \Dogma\Io\LineEndings $lineEndings
35: */
36: public function __construct($file, string $mode = FileMode::OPEN_READ, $streamContext = null, ?Encoding $encoding = null, ?LineEndings $lineEndings = null)
37: {
38: parent::__construct($file, $mode, $streamContext);
39:
40: if ($encoding !== null) {
41: $this->setEncoding($encoding);
42: }
43: if ($lineEndings !== null) {
44: $this->setLineEndings($lineEndings);
45: }
46: }
47:
48: public function setEncoding(Encoding $encoding): void
49: {
50: $this->encoding = $encoding->getValue();
51: }
52:
53: public function setInternalEncoding(Encoding $internalEncoding): void
54: {
55: $this->internalEncoding = $internalEncoding->getValue();
56: }
57:
58: public function setLineEndings(LineEndings $nl): void
59: {
60: $this->nl = $nl->getValue();
61: }
62:
63: public function readLine(): ?string
64: {
65: error_clear_last();
66: $line = fgets($this->handle);
67:
68: if ($line === false) {
69: if ($this->endOfFileReached()) {
70: return null;
71: } else {
72: throw new \Dogma\Io\FileException('Cannot read data from file.', error_get_last());
73: }
74: }
75: if ($this->encoding !== $this->internalEncoding) {
76: $line = $this->decode($line);
77: }
78: return $line;
79: }
80:
81: public function writeLine(string $line): void
82: {
83: if ($this->encoding !== $this->internalEncoding) {
84: $line = $this->encode($line);
85: }
86: $this->write($line . $this->nl);
87: }
88:
89: /**
90: * @param string $delimiter
91: * @param string $quoteChar
92: * @param string $escapeChar
93: * @return string[]
94: */
95: public function readCsvRow(string $delimiter, string $quoteChar, string $escapeChar): array
96: {
97: error_clear_last();
98: $row = fgetcsv($this->handle, 0, $delimiter, $quoteChar, $escapeChar);
99:
100: if ($row === false) {
101: if ($this->endOfFileReached()) {
102: return [];
103: } else {
104: throw new \Dogma\Io\FileException('Cannot read data from file.', error_get_last());
105: }
106: }
107:
108: if ($this->encoding !== $this->internalEncoding) {
109: foreach ($row as &$item) {
110: $item = $this->decode($item);
111: }
112: }
113:
114: return $row;
115: }
116:
117: /**
118: * @param string[] $row
119: * @param string $delimiter
120: * @param string $quoteChar
121: * @return int
122: */
123: public function writeCsvRow(array $row, string $delimiter, string $quoteChar): int
124: {
125: if ($this->encoding !== $this->internalEncoding) {
126: foreach ($row as &$item) {
127: $item = $this->encode($item);
128: }
129: }
130:
131: error_clear_last();
132: $written = fputcsv($this->handle, $row, $delimiter, $quoteChar);
133:
134: if ($written === false) {
135: throw new \Dogma\Io\FileException('Cannot write CSV row', error_get_last());
136: }
137:
138: return $written;
139: }
140:
141: private function encode(string $string): string
142: {
143: error_clear_last();
144: $result = iconv($this->encoding, $this->internalEncoding, $string);
145:
146: if ($result === false) {
147: throw new \Dogma\Io\FileException('Cannot convert file encoding.', error_get_last());
148: }
149:
150: return $result;
151: }
152:
153: private function decode(string $string): string
154: {
155: error_clear_last();
156: $result = iconv($this->internalEncoding, $this->encoding, $string);
157:
158: if ($result === false) {
159: throw new \Dogma\Io\FileException('Cannot convert file encoding.', error_get_last());
160: }
161:
162: return $result;
163: }
164:
165: }
| 0 % | Language\Bumblefuck.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language;
11:
12: class Bumblefuck
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: private static $formats = [
17: 'fullwidth',
18: 'bold',
19: 'italic',
20: 'bold italic',
21: 'script',
22: 'bold script',
23: 'fraktur',
24: 'bold fraktur',
25: 'double',
26: 'sans-serif',
27: 'bold ss',
28: 'italic ss',
29: 'bold italic ss',
30: 'monospace',
31: 'circled',
32: 'negative circled',
33: 'squared',
34: 'negative squared',
35: 'regional indicator',
36: ];
37:
38: private static $bumbles = [
39: 'A' => ['A', '𝐀', '𝐴', '𝑨', '𝒜', '𝓐', '𝔄', '𝕬', '𝔸', '𝖠', '𝗔', '𝘈', '𝘼', '𝙰', 'Ⓐ', '🅐', '🄰', '🅰', '🇦'],
40: 'B' => ['B', '𝐁', '𝐵', '𝑩', 'ℬ', '𝓑', '𝔅', '𝕭', '𝔹', '𝖡', '𝗕', '𝘉', '𝘽', '𝙱', 'Ⓑ', '🅑', '🄱', '🅱', '🇧'],
41: 'C' => ['C', '𝐂', '𝐶', '𝑪', '𝒞', '𝓒', 'ℭ', '𝕮', 'ℂ', '𝖢', '𝗖', '𝘊', '𝘾', '𝙲', 'Ⓒ', '🅒', '🄲', '🅲', '🇨'],
42: 'D' => ['D', '𝐃', '𝐷', '𝑫', '𝒟', '𝓓', '𝔇', '𝕯', '𝔻', '𝖣', '𝗗', '𝘋', '𝘿', '𝙳', 'Ⓓ', '🅓', '🄳', '🅳', '🇩'],
43: 'E' => ['E', '𝐄', '𝐸', '𝑬', 'ℰ', '𝓔', '𝔈', '𝕰', '𝔼', '𝖤', '𝗘', '𝘌', '𝙀', '𝙴', 'Ⓔ', '🅔', '🄴', '🅴', '🇪'],
44: 'F' => ['F', '𝐅', '𝐹', '𝑭', 'ℱ', '𝓕', '𝔉', '𝕱', '𝔽', '𝖥', '𝗙', '𝘍', '𝙁', '𝙵', 'Ⓕ', '🅕', '🄵', '🅵', '🇫'],
45: 'G' => ['G', '𝐆', '𝐺', '𝑮', '𝒢', '𝓖', '𝔊', '𝕲', '𝔾', '𝖦', '𝗚', '𝘎', '𝙂', '𝙶', 'Ⓖ', '🅖', '🄶', '🅶', '🇬'],
46: 'H' => ['H', '𝐇', '𝐻', '𝑯', 'ℋ', '𝓗', 'ℌ', '𝕳', 'ℍ', '𝖧', '𝗛', '𝘏', '𝙃', '𝙷', 'Ⓗ', '🅗', '🄷', '🅷', '🇭'],
47: 'I' => ['I', '𝐈', '𝐼', '𝑰', 'ℐ', '𝓘', 'ℑ', '𝕴', '𝕀', '𝖨', '𝗜', '𝘐', '𝙄', '𝙸', 'Ⓘ', '🅘', '🄸', '🅸', '🇮'],
48: 'J' => ['J', '𝐉', '𝐽', '𝑱', '𝒥', '𝓙', '𝔍', '𝕵', '𝕁', '𝖩', '𝗝', '𝘑', '𝙅', '𝙹', 'Ⓙ', '🅙', '🄹', '🅹', '🇯'],
49: 'K' => ['K', '𝐊', '𝐾', '𝑲', '𝒦', '𝓚', '𝔎', '𝕶', '𝕂', '𝖪', '𝗞', '𝘒', '𝙆', '𝙺', 'Ⓚ', '🅚', '🄺', '🅺', '🇰'],
50: 'L' => ['L', '𝐋', '𝐿', '𝑳', 'ℒ', '𝓛', '𝔏', '𝕷', '𝕃', '𝖫', '𝗟', '𝘓', '𝙇', '𝙻', 'Ⓛ', '🅛', '🄻', '🅻', '🇱'],
51: 'M' => ['M', '𝐌', '𝑀', '𝑴', 'ℳ', '𝓜', '𝔐', '𝕸', '𝕄', '𝖬', '𝗠', '𝘔', '𝙈', '𝙼', 'Ⓜ', '🅜', '🄼', '🅼', '🇲'],
52: 'N' => ['N', '𝐍', '𝑁', '𝑵', '𝒩', '𝓝', '𝔑', '𝕹', 'ℕ', '𝖭', '𝗡', '𝘕', '𝙉', '𝙽', 'Ⓝ', '🅝', '🄽', '🅽', '🇳'],
53: 'O' => ['O', '𝐎', '𝑂', '𝑶', '𝒪', '𝓞', '𝔒', '𝕺', '𝕆', '𝖮', '𝗢', '𝘖', '𝙊', '𝙾', 'Ⓞ', '🅞', '🄾', '🅾', '🇴'],
54: 'P' => ['P', '𝐏', '𝑃', '𝑷', '𝒫', '𝓟', '𝔓', '𝕻', 'ℙ', '𝖯', '𝗣', '𝘗', '𝙋', '𝙿', 'Ⓟ', '🅟', '🄿', '🅿', '🇵'],
55: 'Q' => ['Q', '𝐐', '𝑄', '𝑸', '𝒬', '𝓠', '𝔔', '𝕼', 'ℚ', '𝖰', '𝗤', '𝘘', '𝙌', '𝚀', 'Ⓠ', '🅠', '🅀', '🆀', '🇶'],
56: 'R' => ['R', '𝐑', '𝑅', '𝑹', 'ℛ', '𝓡', 'ℜ', '𝕽', 'ℝ', '𝖱', '𝗥', '𝘙', '𝙍', '𝚁', 'Ⓡ', '🅡', '🅁', '🆁', '🇷'],
57: 'S' => ['S', '𝐒', '𝑆', '𝑺', '𝒮', '𝓢', '𝔖', '𝕾', '𝕊', '𝖲', '𝗦', '𝘚', '𝙎', '𝚂', 'Ⓢ', '🅢', '🅂', '🆂', '🇸'],
58: 'T' => ['T', '𝐓', '𝑇', '𝑻', '𝒯', '𝓣', '𝔗', '𝕿', '𝕋', '𝖳', '𝗧', '𝘛', '𝙏', '𝚃', 'Ⓣ', '🅣', '🅃', '🆃', '🇹'],
59: 'U' => ['U', '𝐔', '𝑈', '𝑼', '𝒰', '𝓤', '𝔘', '𝖀', '𝕌', '𝖴', '𝗨', '𝘜', '𝙐', '𝚄', 'Ⓤ', '🅤', '🅄', '🆄', '🇺'],
60: 'V' => ['V', '𝐕', '𝑉', '𝑽', '𝒱', '𝓥', '𝔙', '𝖁', '𝕍', '𝖵', '𝗩', '𝘝', '𝙑', '𝚅', 'Ⓥ', '🅥', '🅅', '🆅', '🇻'],
61: 'W' => ['W', '𝐖', '𝑊', '𝑾', '𝒲', '𝓦', '𝔚', '𝖂', '𝕎', '𝖶', '𝗪', '𝘞', '𝙒', '𝚆', 'Ⓦ', '🅦', '🅆', '🆆', '🇼'],
62: 'X' => ['X', '𝐗', '𝑋', '𝑿', '𝒳', '𝓧', '𝔛', '𝖃', '𝕏', '𝖷', '𝗫', '𝘟', '𝙓', '𝚇', 'Ⓧ', '🅧', '🅇', '🆇', '🇽'],
63: 'Y' => ['Y', '𝐘', '𝑌', '𝒀', '𝒴', '𝓨', '𝔜', '𝖄', '𝕐', '𝖸', '𝗬', '𝘠', '𝙔', '𝚈', 'Ⓨ', '🅨', '🅈', '🆈', '🇾'],
64: 'Z' => ['Z', '𝐙', '𝑍', '𝒁', '𝒵', '𝓩', 'ℨ', '𝖅', 'ℤ', '𝖹', '𝗭', '𝘡', '𝙕', '𝚉', 'Ⓩ', '🅩', '🅉', '🆉', '🇿'],
65: 'a' => ['a', '𝐚', '𝑎', '𝒂', '𝒶', '𝓪', '𝔞', '𝖆', '𝕒', '𝖺', '𝗮', '𝘢', '𝙖', '𝚊', 'ⓐ', '', '', '', ''],
66: 'b' => ['b', '𝐛', '𝑏', '𝒃', '𝒷', '𝓫', '𝔟', '𝖇', '𝕓', '𝖻', '𝗯', '𝘣', '𝙗', '𝚋', 'ⓑ', '', '', '', ''],
67: 'c' => ['c', '𝐜', '𝑐', '𝒄', '𝒸', '𝓬', '𝔠', '𝖈', '𝕔', '𝖼', '𝗰', '𝘤', '𝙘', '𝚌', 'ⓒ', '', '', '', ''],
68: 'd' => ['d', '𝐝', '𝑑', '𝒅', '𝒹', '𝓭', '𝔡', '𝖉', '𝕕', '𝖽', '𝗱', '𝘥', '𝙙', '𝚍', 'ⓓ', '', '', '', ''],
69: 'e' => ['e', '𝐞', '𝑒', '𝒆', 'ℯ', '𝓮', '𝔢', '𝖊', '𝕖', '𝖾', '𝗲', '𝘦', '𝙚', '𝚎', 'ⓔ', '', '', '', ''],
70: 'f' => ['f', '𝐟', '𝑓', '𝒇', '𝒻', '𝓯', '𝔣', '𝖋', '𝕗', '𝖿', '𝗳', '𝘧', '𝙛', '𝚏', 'ⓕ', '', '', '', ''],
71: 'g' => ['g', '𝐠', '𝑔', '𝒈', 'ℊ', '𝓰', '𝔤', '𝖌', '𝕘', '𝗀', '𝗴', '𝘨', '𝙜', '𝚐', 'ⓖ', '', '', '', ''],
72: 'h' => ['h', '𝐡', 'ℎ', '𝒉', '𝒽', '𝓱', '𝔥', '𝖍', '𝕙', '𝗁', '𝗵', '𝘩', '𝙝', '𝚑', 'ⓗ', '', '', '', ''],
73: 'i' => ['i', '𝐢', '𝑖', '𝒊', '𝒾', '𝓲', '𝔦', '𝖎', '𝕚', '𝗂', '𝗶', '𝘪', '𝙞', '𝚒', 'ⓘ', '', '', '', ''],
74: 'j' => ['j', '𝐣', '𝑗', '𝒋', '𝒿', '𝓳', '𝔧', '𝖏', '𝕛', '𝗃', '𝗷', '𝘫', '𝙟', '𝚓', 'ⓙ', '', '', '', ''],
75: 'k' => ['k', '𝐤', '𝑘', '𝒌', '𝓀', '𝓴', '𝔨', '𝖐', '𝕜', '𝗄', '𝗸', '𝘬', '𝙠', '𝚔', 'ⓚ', '', '', '', ''],
76: 'l' => ['l', '𝐥', '𝑙', '𝒍', '𝓁', '𝓵', '𝔩', '𝖑', '𝕝', '𝗅', '𝗹', '𝘭', '𝙡', '𝚕', 'ⓛ', '', '', '', ''],
77: 'm' => ['m', '𝐦', '𝑚', '𝒎', '𝓂', '𝓶', '𝔪', '𝖒', '𝕞', '𝗆', '𝗺', '𝘮', '𝙢', '𝚖', 'ⓜ', '', '', '', ''],
78: 'n' => ['n', '𝐧', '𝑛', '𝒏', '𝓃', '𝓷', '𝔫', '𝖓', '𝕟', '𝗇', '𝗻', '𝘯', '𝙣', '𝚗', 'ⓝ', '', '', '', ''],
79: 'o' => ['o', '𝐨', '𝑜', '𝒐', 'ℴ', '𝓸', '𝔬', '𝖔', '𝕠', '𝗈', '𝗼', '𝘰', '𝙤', '𝚘', 'ⓞ', '', '', '', ''],
80: 'p' => ['p', '𝐩', '𝑝', '𝒑', '𝓅', '𝓹', '𝔭', '𝖕', '𝕡', '𝗉', '𝗽', '𝘱', '𝙥', '𝚙', 'ⓟ', '', '', '', ''],
81: 'q' => ['q', '𝐪', '𝑞', '𝒒', '𝓆', '𝓺', '𝔮', '𝖖', '𝕢', '𝗊', '𝗾', '𝘲', '𝙦', '𝚚', 'ⓠ', '', '', '', ''],
82: 'r' => ['r', '𝐫', '𝑟', '𝒓', '𝓇', '𝓻', '𝔯', '𝖗', '𝕣', '𝗋', '𝗿', '𝘳', '𝙧', '𝚛', 'ⓡ', '', '', '', ''],
83: 's' => ['s', '𝐬', '𝑠', '𝒔', '𝓈', '𝓼', '𝔰', '𝖘', '𝕤', '𝗌', '𝘀', '𝘴', '𝙨', '𝚜', 'ⓢ', '', '', '', ''],
84: 't' => ['t', '𝐭', '𝑡', '𝒕', '𝓉', '𝓽', '𝔱', '𝖙', '𝕥', '𝗍', '𝘁', '𝘵', '𝙩', '𝚝', 'ⓣ', '', '', '', ''],
85: 'u' => ['u', '𝐮', '𝑢', '𝒖', '𝓊', '𝓾', '𝔲', '𝖚', '𝕦', '𝗎', '𝘂', '𝘶', '𝙪', '𝚞', 'ⓤ', '', '', '', ''],
86: 'v' => ['v', '𝐯', '𝑣', '𝒗', '𝓋', '𝓿', '𝔳', '𝖛', '𝕧', '𝗏', '𝘃', '𝘷', '𝙫', '𝚟', 'ⓥ', '', '', '', ''],
87: 'w' => ['w', '𝐰', '𝑤', '𝒘', '𝓌', '𝔀', '𝔴', '𝖜', '𝕨', '𝗐', '𝘄', '𝘸', '𝙬', '𝚠', 'ⓦ', '', '', '', ''],
88: 'x' => ['x', '𝐱', '𝑥', '𝒙', '𝓍', '𝔁', '𝔵', '𝖝', '𝕩', '𝗑', '𝘅', '𝘹', '𝙭', '𝚡', 'ⓧ', '', '', '', ''],
89: 'y' => ['y', '𝐲', '𝑦', '𝒚', '𝓎', '𝔂', '𝔶', '𝖞', '𝕪', '𝗒', '𝘆', '𝘺', '𝙮', '𝚢', 'ⓨ', '', '', '', ''],
90: 'z' => ['z', '𝐳', '𝑧', '𝒛', '𝓏', '𝔃', '𝔷', '𝖟', '𝕫', '𝗓', '𝘇', '𝘻', '𝙯', '𝚣', 'ⓩ', '', '', '', ''],
91: ];
92:
93: }
| 0 % | Language\Collator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language;
11:
12: use Dogma\Arr;
13: use Dogma\Check;
14: use Dogma\Language\Locale\Locale;
15: use Dogma\Language\Locale\LocaleCollation;
16: use Dogma\Language\Locale\LocaleKeyword;
17: use Dogma\Type;
18:
19: class Collator extends \Collator
20: {
21:
22: /** @var bool */
23: private $backwards = false;
24:
25: /**
26: * @param \Dogma\Language\Locale\Locale|string $locale
27: */
28: public function __construct($locale)
29: {
30: Check::types($locale, [Locale::class, Type::STRING]);
31:
32: if (is_string($locale)) {
33: $locale = Locale::get($locale);
34: }
35:
36: $collation = $locale->getCollation();
37: $options = $locale->getCollationOptions();
38:
39: if ($collation === null && $options === []) {
40: parent::__construct($locale->getValue());
41: } else {
42: // work around bug with parsing locale collation
43: $safeLocale = $locale->removeCollation();
44:
45: parent::__construct($safeLocale->getValue());
46:
47: $this->configure($collation, $options);
48: }
49: }
50:
51: /**
52: * @param \Dogma\Language\Locale\Locale|string $locale
53: * @return self
54: */
55: public static function create($locale): self
56: {
57: return new self($locale);
58: }
59:
60: /**
61: * @param \Dogma\Language\Locale\LocaleCollation|null $collation
62: * @param mixed[] $collationOptions
63: */
64: public function configure(?LocaleCollation $collation = null, array $collationOptions = []): void
65: {
66: if ($collation !== null) {
67: /// not supported?
68: }
69: /** @var \Dogma\Language\Locale\LocaleCollationOption $value */
70: foreach ($collationOptions as $keyword => $value) {
71: switch ($keyword) {
72: case LocaleKeyword::COL_ALTERNATE:
73: $this->setAttribute(self::ALTERNATE_HANDLING, $value->getCollatorValue());
74: break;
75: case LocaleKeyword::COL_BACKWARDS:
76: // cannot be configured directly
77: if ($value->getCollatorValue() === self::ON) {
78: $this->backwards = true;
79: }
80: break;
81: case LocaleKeyword::COL_CASE_FIRST:
82: $this->setAttribute(self::CASE_FIRST, $value->getCollatorValue());
83: break;
84: case LocaleKeyword::COL_HIRAGANA_QUATERNARY:
85: $this->setAttribute(self::HIRAGANA_QUATERNARY_MODE, $value->getCollatorValue());
86: break;
87: case LocaleKeyword::COL_NORMALIZATION:
88: $this->setAttribute(self::NORMALIZATION_MODE, $value->getCollatorValue());
89: break;
90: case LocaleKeyword::COL_NUMERIC:
91: $this->setAttribute(self::NUMERIC_COLLATION, $value->getCollatorValue());
92: break;
93: case LocaleKeyword::COL_STRENGTH:
94: $this->setStrength($value->getCollatorValue());
95: break;
96: }
97: }
98: }
99:
100: public function getLocaleObject(int $type = \Locale::ACTUAL_LOCALE): Locale
101: {
102: return Locale::get($this->getLocale($type));
103: }
104:
105: /**
106: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
107: * @param string $str1
108: * @param string $str2
109: * @return int
110: */
111: public function compare($str1, $str2): int
112: {
113: if ($this->backwards) {
114: return parent::compare($str2, $str1);
115: } else {
116: return parent::compare($str1, $str2);
117: }
118: }
119:
120: /**
121: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
122: * @param mixed[] $arr
123: * @param int|null $sortFlag
124: */
125: public function asort(array &$arr, $sortFlag = null): void
126: {
127: parent::asort($arr, $sortFlag);
128: if ($this->backwards) {
129: $arr = Arr::reverse($arr);
130: }
131: }
132:
133: /**
134: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
135: * @param mixed[] $arr
136: * @param int|null $sortFlag
137: */
138: public function sort(array &$arr, $sortFlag = null): void
139: {
140: parent::sort($arr, $sortFlag);
141: if ($this->backwards) {
142: $arr = Arr::reverse($arr);
143: }
144: }
145:
146: /**
147: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
148: * @param mixed[] $arr
149: */
150: public function sortWithSortKeys(array &$arr): void
151: {
152: parent::sortWithSortKeys($arr);
153: if ($this->backwards) {
154: $arr = Arr::reverse($arr);
155: }
156: }
157:
158: public function __invoke(string $str1, string $str2): int
159: {
160: return $this->compare($str1, $str2);
161: }
162:
163: }
| 83 % | Language\Encoding.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language;
11:
12: /**
13: * Encoding codes accepted by mbstring and iconv (except BINARY; not all of them)
14: */
15: class Encoding extends \Dogma\Enum\StringEnum
16: {
17:
18: public const BINARY = 'BINARY';
19:
20: public const ASCII = 'ASCII';
21:
22: public const UTF_8 = 'UTF-8';
23:
24: public const UTF_7 = 'UTF-7';
25: public const UTF_7_IMAP = 'UTF7-IMAP';
26:
27: public const UTF_16 = 'UTF-16';
28: public const UTF_16BE = 'UTF-16BE';
29: public const UTF_16LE = 'UTF-16LE';
30:
31: public const UTF_32 = 'UTF-32';
32: public const UTF_32BE = 'UTF-32BE';
33: public const UTF_32LE = 'UTF-32LE';
34:
35: public const UCS_2 = 'UCS-2';
36: public const UCS_2BE = 'UCS-2BE';
37: public const UCS_2LE = 'UCS-2LE';
38:
39: public const UCS_4 = 'UCS-4';
40: public const UCS_4BE = 'UCS-4BE';
41: public const UCS_4LE = 'UCS-4LE';
42:
43: public const ISO_8859_1 = 'ISO-8859-1'; // Latin-1 Western European
44: public const ISO_8859_2 = 'ISO-8859-2'; // Latin-2 Central European
45: public const ISO_8859_3 = 'ISO-8859-3'; // Latin-3 South European
46: public const ISO_8859_4 = 'ISO-8859-4'; // Latin-4 North European
47: public const ISO_8859_5 = 'ISO-8859-5'; // Latin/Cyrillic
48: public const ISO_8859_6 = 'ISO-8859-6'; // Latin/Arabic
49: public const ISO_8859_7 = 'ISO-8859-7'; // Latin/Greek
50: public const ISO_8859_8 = 'ISO-8859-8'; // Latin/Hebrew
51: public const ISO_8859_9 = 'ISO-8859-9'; // Latin-5 Turkish
52: public const ISO_8859_10 = 'ISO-8859-10'; // Latin-6 Nordic
53: public const ISO_8859_11 = 'ISO-8859-11'; // Latin/Thai
54: public const ISO_8859_13 = 'ISO-8859-13'; // Latin-7 Baltic Rim
55: public const ISO_8859_14 = 'ISO-8859-14'; // Latin-8 Celtic
56: public const ISO_8859_15 = 'ISO-8859-15'; // Latin-9
57: public const ISO_8859_16 = 'ISO-8859-16'; // Latin-10 South-Eastern European
58:
59: public const WINDOWS_1250 = 'WINDOWS-1250'; // Latin 2 / Central European
60: public const WINDOWS_1251 = 'WINDOWS-1251'; // Cyrillic
61: public const WINDOWS_1252 = 'WINDOWS-1252'; // Latin 1 / Western European
62: public const WINDOWS_1253 = 'WINDOWS-1253'; // Greek
63: public const WINDOWS_1254 = 'WINDOWS-1254'; // Turkish
64: public const WINDOWS_1255 = 'WINDOWS-1255'; // Hebrew
65: public const WINDOWS_1256 = 'WINDOWS-1256'; // Arabic
66: public const WINDOWS_1257 = 'WINDOWS-1257'; // Baltic
67: public const WINDOWS_1258 = 'WINDOWS-1258'; // Vietnamese
68:
69: public const CP850 = 'CP850'; // DOS Latin 1 Western European
70: public const CP852 = 'CP852'; // DOS Latin 2 Central European
71: public const CP862 = 'CP862'; // DOS Hebrew
72: public const CP866 = 'CP866'; // DOS Cyrillic
73: public const CP932 = 'CP932'; // IBM SJIS
74: public const CP936 = 'CP936'; // IBM Simplified Chinese
75: public const CP950 = 'CP950'; // MS BIG-5
76:
77: public const CP50220 = 'CP50220';
78: public const CP50221 = 'CP50221';
79: public const CP50222 = 'CP50222';
80: public const CP51932 = 'CP51932';
81:
82: public const EUC_JP = 'EUC-JP';
83: public const EUC_JP_WIN = 'EUC-JP-WIN';
84: public const EUC_JP_2004 = 'EUC-JP-2004';
85: public const EUC_CN = 'EUC-CN';
86: public const EUC_TW = 'EUC-TW';
87: public const EUC_KR = 'EUC-KR';
88:
89: public const JIS = 'JIS';
90: public const JIS_MS = 'JIS-MS';
91:
92: public const SJIS = 'SJIS';
93: public const SJIS_WIN = 'SJIS-WIN';
94: public const SJIS_MAC = 'SJIS-MAC';
95: public const SJIS_2004 = 'SJIS-2004';
96:
97: public const ISO_2022_JP = 'ISO-2022-JP';
98: public const ISO_2022_JP_MS = 'ISO-2022-JP-MS';
99: public const ISO_2022_JP_2004 = 'ISO-2022-JP-2004';
100: public const ISO_2022_KR = 'ISO-2022-KR';
101:
102: public const KOI8_R = 'KOI8-R';
103: public const KOI8_U = 'KOI8-U';
104: public const KOI8_T = 'KOI8-T';
105:
106: public const GB18030 = 'GB18030';
107:
108: public const BIG_5 = 'BIG-5';
109:
110: public const UHC = 'UHC';
111:
112: public const HZ = 'HZ';
113:
114: public const ARMSCII_8 = 'ARMSCII-8';
115:
116: public static function validateValue(string &$value): bool
117: {
118: $value = strtoupper($value);
119:
120: return parent::validateValue($value);
121: }
122:
123: public static function getValueRegexp(): string
124: {
125: return 'BINARY|ASCII|UTF-(?:8|7(?:-IMAP)?|(?:(?:16|32)(?:BE|LE)?))|UCS-[24](?:BE|LE)'
126: . '|ISO-8859-(?:1(0-6)?|[2-9])|WINDOWS-125[0-8]|CP[89]\\d\\d|CP5022[012]|CP51932'
127: . '|EUC-(?:JP(?:-2004)?|CN|TW|KR)|EUC-JP-WIN|JIS(?:-MS)?|SJIS(?:-WIN|-MAC|2004)?'
128: . '|ISO-2022-(?:JP(?:-MS|-2004)?|KR)|KOI8-[RUT]|GB18030|BIG-5|UHC|HZ|ARMSCII-8';
129: }
130:
131: }
| 0 % | Language\exceptions\CollatorException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language;
11:
12: class CollatorException extends \Dogma\Language\Exception
13: {
14:
15: }
| 0 % | Language\exceptions\Exception.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language;
11:
12: class Exception extends \Dogma\Exception
13: {
14:
15: }
| 0 % | Language\exceptions\TransliteratorException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language;
11:
12: class TransliteratorException extends \Dogma\Language\Exception
13: {
14:
15: }
| 5 % | Language\Inflector.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language;
11:
12: use Dogma\Str;
13:
14: class Inflector
15: {
16:
17: /** @var string[] */
18: public static $singulars = [
19: '/(quiz)$/i' => '\1zes',
20: '/^(ox)$/i' => '\1en',
21: '/([m|l])ouse$/i' => '\1ice',
22: '/(matr|vert|ind)(?:ix|ex)$/i' => '\1ices',
23: '/(x|ch|ss|sh)$/i' => '\1es',
24: '/([^aeiouy]|qu)y$/i' => '\1ies',
25: '/(hive)$/i' => '\1s',
26: '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
27: '/sis$/i' => 'ses',
28: '/([ti])um$/i' => '\1a',
29: '/(buffal|tomat)o$/i' => '\1oes',
30: '/(bu)s$/i' => '\1ses',
31: '/(alias|status)$/i' => '\1es',
32: '/(octop|vir)us$/i' => '\1i',
33: '/(ax|test)is$/i' => '\1es',
34: '/s$/i' => 's',
35: '/$/' => 's',
36: ];
37:
38: /** @var string[] */
39: public static $plurals = [
40: '/(database)s$/i' => '\1',
41: '/(quiz)zes$/i' => '\1',
42: '/(matr)ices$/i' => '\1ix',
43: '/(vert|ind)ices$/i' => '\1ex',
44: '/^(ox)en/i' => '\1',
45: '/(alias|status)es$/i' => '\1',
46: '/(octop|vir)i$/i' => '\1us',
47: '/(cris|ax|test)es$/i' => '\1is',
48: '/(shoe)s$/i' => '\1',
49: '/(o)es$/i' => '\1',
50: '/(bus)es$/i' => '\1',
51: '/([m|l])ice$/i' => '\1ouse',
52: '/(x|ch|ss|sh)es$/i' => '\1',
53: '/(m)ovies$/i' => '\1ovie',
54: '/(s)eries$/i' => '\1eries',
55: '/([^aeiouy]|qu)ies$/i' => '\1y',
56: '/([lr])ves$/i' => '\1f',
57: '/(tive)s$/i' => '\1',
58: '/(hive)s$/i' => '\1',
59: '/([^f])ves$/i' => '\1fe',
60: '/(^analy)ses$/i' => '\1sis',
61: '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
62: '/([ti])a$/i' => '\1um',
63: '/(n)ews$/i' => '\1ews',
64: '/s$/i' => '',
65: ];
66:
67: /** @var string[] of irregular nouns */
68: public static $irregular = [
69: 'person' => 'people',
70: 'man' => 'men',
71: 'child' => 'children',
72: 'sex' => 'sexes',
73: 'move' => 'moves',
74: 'cow' => 'kine',
75: ];
76:
77: /** @var string[] of uncountable nouns */
78: public static $uncountable = [
79: 'equipment',
80: 'information',
81: 'rice',
82: 'money',
83: 'species',
84: 'series',
85: 'fish',
86: 'sheep',
87: ];
88:
89: public static function singularize(string $word): string
90: {
91: $lower = Str::lower($word);
92:
93: if (self::isSingular($word)) {
94: return $word;
95: }
96:
97: if (!self::isCountable($word)) {
98: return $word;
99: }
100:
101: if (self::isIrregular($word)) {
102: foreach (self::$irregular as $single => $plural) {
103: if ($lower === $plural) {
104: return $single;
105: }
106: }
107: }
108:
109: foreach (self::$plurals as $rule => $replacement) {
110: if (preg_match($rule, $word)) {
111: return preg_replace($rule, $replacement, $word);
112: }
113: }
114:
115: return $word;
116: }
117:
118: public static function pluralize(string $word): string
119: {
120: $lower = Str::lower($word);
121:
122: if (self::isPlural($word)) {
123: return $word;
124: }
125:
126: if (!self::isCountable($word)) {
127: return $word;
128: }
129:
130: if (self::isIrregular($word)) {
131: return self::$irregular[$lower];
132: }
133:
134: foreach (self::$singulars as $rule => $replacement) {
135: if (preg_match($rule, $word)) {
136: return preg_replace($rule, $replacement, $word);
137: }
138: }
139:
140: return $word;
141: }
142:
143: public static function isSingular(string $word): bool
144: {
145: if (!self::isCountable($word)) {
146: return true;
147: }
148:
149: return !self::isPlural($word);
150: }
151:
152: public static function isPlural(string $word): bool
153: {
154: $lower = Str::lower($word);
155:
156: if (!self::isCountable($word)) {
157: return true;
158: }
159:
160: if (self::isIrregular($word)) {
161: return in_array($lower, array_values(self::$irregular));
162: }
163:
164: foreach (self::$plurals as $rule => $replacement) {
165: if (preg_match($rule, $word)) {
166: return true;
167: }
168: }
169:
170: return false;
171: }
172:
173: public static function isCountable(string $word): bool
174: {
175: $lower = Str::lower($word);
176:
177: return !in_array($lower, self::$uncountable);
178: }
179:
180: public static function isIrregular(string $word): bool
181: {
182: $lower = Str::lower($word);
183:
184: return in_array($lower, self::$irregular) || array_key_exists($lower, self::$irregular);
185: }
186:
187: /**
188: * Ordinalize turns a number into an ordinal string used to denote
189: * the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
190: * @param int $number
191: * @return string
192: */
193: public static function ordinalize(int $number): string
194: {
195: if ($number % 100 >= 11 && $number % 100 <= 13) {
196: return $number . 'th';
197: } else {
198: switch ($number % 10) {
199: case 1:
200: return $number . 'st';
201: case 2:
202: return $number . 'nd';
203: case 3:
204: return $number . 'rd';
205: default:
206: return $number . 'th';
207: }
208: }
209: }
210:
211: /**
212: * By default, camelize() converts strings to UpperCamelCase.
213: * If the second argument is set to false then camelize() produces lowerCamelCase.
214: * camelize() will also convert '/' to '\' which is useful for converting paths to namespaces.
215: * @param string $word
216: * @param bool $firstUpper
217: * @return string
218: */
219: public static function camelize(string $word, bool $firstUpper = true): string
220: {
221: $word = preg_replace(['/(^|_)(.)/e', '/(\/)(.)/e'], ["strtoupper('\\2')", "strtoupper('\\2')"], strval($word));
222:
223: return $firstUpper ? ucfirst($word) : lcfirst($word);
224: }
225:
226: /**
227: * Replaces underscores with dashes in the string.
228: * @param string $word
229: * @return string
230: */
231: public static function dasherize(string $word): string
232: {
233: return preg_replace('/_/', '-', strval($word));
234: }
235:
236: /**
237: * Capitalizes all the words and replaces some characters in the string to create a nicer looking title.
238: * Titleize() is meant for creating pretty output.
239: * @param string $word
240: * @return string
241: */
242: public static function titleize(string $word): string
243: {
244: return preg_replace(["/\b('?[a-z])/e"], ["ucfirst('\\1')"], self::humanize(self::underscore($word)));
245: }
246:
247: /**
248: * The reverse of camelize(). Makes an underscored form from the expression in the string.
249: * Changes '::' to '/' to convert namespaces to paths.
250: * @param string $word
251: * @return string
252: */
253: public static function underscore(string $word): string
254: {
255: return strtolower(preg_replace('/([A-Z]+)([A-Z])/', '\1_\2', preg_replace('/([a-z\d])([A-Z])/', '\1_\2', $word)));
256: }
257:
258: /**
259: * Capitalizes the first word and turns underscores into spaces and strips _id.
260: * Like titleize(), this is meant for creating pretty output.
261: * @param string $word
262: * @return string
263: */
264: public static function humanize(string $word): string
265: {
266: return ucfirst(strtolower(preg_replace(['/_id$/', '/_/'], ['', ' '], $word)));
267: }
268:
269: }
| 50 % | Language\Language.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language;
11:
12: /**
13: * 2-letter language codes by ISO-639
14: */
15: class Language extends \Dogma\Enum\StringEnum
16: {
17:
18: public const ABKHAZ = 'ab';
19: public const AFAR = 'aa';
20: public const AFRIKAANS = 'af';
21: public const AKAN = 'ak';
22: public const ALBANIAN = 'sq';
23: public const AMHARIC = 'am';
24: public const ARABIC = 'ar';
25: public const ARAGONESE = 'an';
26: public const ARMENIAN = 'hy';
27: public const ASSAMESE = 'as';
28: public const AVARIC = 'av';
29: public const AVESTAN = 'ae';
30: public const AYMARA = 'ay';
31: public const AZERBAIJANI = 'az';
32: public const BAMBARA = 'bm';
33: public const BASHKIR = 'ba';
34: public const BASQUE = 'eu';
35: public const BELARUSIAN = 'be';
36: public const BENGALI = 'bn';
37: public const BIHARI = 'bh';
38: public const BISLAMA = 'bi';
39: public const BOSNIAN = 'bs';
40: public const BRETON = 'br';
41: public const BULGARIAN = 'bg';
42: public const BURMESE = 'my';
43: public const CATALAN = 'ca';
44: public const CHAMORRO = 'ch';
45: public const CHECHEN = 'ce';
46: public const CHICHEWA = 'ny';
47: public const CHINESE = 'zh';
48: public const CHURCH_SLAVIC = 'cu';
49: public const CHUVASH = 'cv';
50: public const CORNISH = 'kw';
51: public const CORSICAN = 'co';
52: public const CREE = 'cr';
53: public const CROATIAN = 'hr';
54: public const CZECH = 'cs';
55: public const DANISH = 'da';
56: public const DIVEHI = 'dv';
57: public const DUTCH = 'nl';
58: public const DZONGKHA = 'dz';
59: public const ENGLISH = 'en';
60: public const ESPERANTO = 'eo';
61: public const ESTONIAN = 'et';
62: public const EWE = 'ee';
63: public const FAROESE = 'fo';
64: public const FIJIAN = 'fj';
65: public const FINNISH = 'fi';
66: public const FRENCH = 'fr';
67: public const FULAH = 'ff';
68: public const GAELIC = 'gd';
69: public const GALICIAN = 'gl';
70: public const GANDA = 'lg';
71: public const GEORGIAN = 'ka';
72: public const GERMAN = 'de';
73: public const GREEK = 'el';
74: public const GUARANI = 'gn';
75: public const GUJARATI = 'gu';
76: public const HAITIAN = 'ht';
77: public const HAUSA = 'ha';
78: public const HEBREW = 'he';
79: public const HERERO = 'hz';
80: public const HINDI = 'hi';
81: public const HIRI_MOTU = 'ho';
82: public const HUNGARIAN = 'hu';
83: public const ICELANDIC = 'is';
84: public const IDO = 'io';
85: public const IGBO = 'ig';
86: public const INDONESIAN = 'id';
87: public const INTERLINGUA = 'ia';
88: public const INTERLINGUE = 'ie';
89: public const INUIT = 'iu';
90: public const INUPIAQ = 'ik';
91: public const IRISH = 'ga';
92: public const ITALIAN = 'it';
93: public const JAPANESE = 'ja';
94: public const JAVANESE = 'jv';
95: public const KALAALLISUT = 'kl';
96: public const KANNADA = 'kn';
97: public const KANURI = 'kr';
98: public const KASHMIRI = 'ks';
99: public const KAZAKH = 'kk';
100: public const KHMER = 'km';
101: public const KIKUYU = 'ki';
102: public const KINYARWANDA = 'rw';
103: public const KIRGHIZ = 'ky';
104: public const KIRUNDI = 'rn';
105: public const KOMI = 'kv';
106: public const KONGO = 'kg';
107: public const KOREAN = 'ko';
108: public const KUANYAMA = 'kj';
109: public const KURDISH = 'ku';
110: public const LAO = 'lo';
111: public const LATIN = 'la';
112: public const LATVIAN = 'lv';
113: public const LIMBURGISH = 'li';
114: public const LINGALA = 'ln';
115: public const LITHUANIAN = 'lt';
116: public const LUBA_KATANGA = 'lu';
117: public const LUXEMBOURGISH = 'lb';
118: public const MACEDONIAN = 'mk';
119: public const MALAGASY = 'mg';
120: public const MALAY = 'ms';
121: public const MALAYALAM = 'ml';
122: public const MALTESE = 'mt';
123: public const MANX = 'gv';
124: public const MAORI = 'mi';
125: public const MARATHI = 'mr';
126: public const MARSHALLESE = 'mh';
127: public const MOLDAVIAN = 'mo';
128: public const MONGOLIAN = 'mn';
129: public const NAURU = 'na';
130: public const NAVAJO = 'nv';
131: public const NDONGA = 'ng';
132: public const NEPALI = 'ne';
133: public const NORTHERN_SAMI = 'se';
134: public const NORTH_NDEBELE = 'nd';
135: public const NORWEGIAN = 'no';
136: public const NORWEGIAN_BOKMAL = 'nb';
137: public const NORWEGIAN_NYNORSK = 'nn';
138: public const OCCITAN = 'oc';
139: public const OJIBWA = 'oj';
140: public const ORIYA = 'or';
141: public const OROMO = 'om';
142: public const OSSETIAN = 'os';
143: public const PALI = 'pi';
144: public const PANJABI = 'pa';
145: public const PASHTO = 'ps';
146: public const PERSIAN = 'fa';
147: public const POLISH = 'pl';
148: public const PORTUGUESE = 'pt';
149: public const QUECHUA = 'qu';
150: public const RAETO_ROMANCE = 'rm';
151: public const ROMANIAN = 'ro';
152: public const RUSSIAN = 'ru';
153: public const RUSYN = 'ry';
154: public const SAMOAN = 'sm';
155: public const SANGO = 'sg';
156: public const SANSKRIT = 'sa';
157: public const SARDINIAN = 'sc';
158: public const SERBIAN = 'sr';
159: public const SERBO_CROATIAN = 'sh';
160: public const SHONA = 'sn';
161: public const SICHUAN_YI = 'ii';
162: public const SINDHI = 'sd';
163: public const SINHALA = 'si';
164: public const SLOVAK = 'sk';
165: public const SLOVENIAN = 'sl';
166: public const SOMALI = 'so';
167: public const SOUTHERN_SOTHO = 'st';
168: public const SOUTH_NDEBELE = 'nr';
169: public const SPANISH = 'es';
170: public const SUNDANESE = 'su';
171: public const SWAHILI = 'sw';
172: public const SWATI = 'ss';
173: public const SWEDISH = 'sv';
174: public const TAGALOG = 'tl';
175: public const TAHITIAN = 'ty';
176: public const TAJIK = 'tg';
177: public const TAMIL = 'ta';
178: public const TATAR = 'tt';
179: public const TELUGU = 'te';
180: public const THAI = 'th';
181: public const TIBETAN = 'bo';
182: public const TIGRINYA = 'ti';
183: public const TONGA = 'to';
184: public const TSONGA = 'ts';
185: public const TSWANA = 'tn';
186: public const TURKISH = 'tr';
187: public const TURKMEN = 'tk';
188: public const TWI = 'tw';
189: public const UIGHUR = 'ug';
190: public const UKRAINIAN = 'uk';
191: public const URDU = 'ur';
192: public const UZBEK = 'uz';
193: public const VENDA = 've';
194: public const VIETNAMESE = 'vi';
195: public const VOLAPUK = 'vo';
196: public const WALLOON = 'wa';
197: public const WELSH = 'cy';
198: public const WESTERN_FRISIAN = 'fy';
199: public const WOLOF = 'wo';
200: public const XHOSA = 'xh';
201: public const YIDDISH = 'yi';
202: public const YORUBA = 'yo';
203: public const ZHUANG = 'za';
204: public const ZULU = 'zu';
205:
206: /** @var string[] */
207: private static $names = [
208: self::ABKHAZ => 'abkhaz',
209: self::AFAR => 'afar',
210: self::AFRIKAANS => 'afrikaans',
211: self::AKAN => 'akan',
212: self::ALBANIAN => 'albanian',
213: self::AMHARIC => 'amharic',
214: self::ARABIC => 'arabic',
215: self::ARAGONESE => 'aragonese',
216: self::ARMENIAN => 'armenian',
217: self::ASSAMESE => 'assamese',
218: self::AVARIC => 'avaric',
219: self::AVESTAN => 'avestan',
220: self::AYMARA => 'aymara',
221: self::AZERBAIJANI => 'azerbaijani',
222: self::BAMBARA => 'bambara',
223: self::BASHKIR => 'bashkir',
224: self::BASQUE => 'basque',
225: self::BELARUSIAN => 'belarusian',
226: self::BENGALI => 'bengali',
227: self::BIHARI => 'bihari',
228: self::BISLAMA => 'bislama',
229: self::BOSNIAN => 'bosnian',
230: self::BRETON => 'breton',
231: self::BULGARIAN => 'bulgarian',
232: self::BURMESE => 'burmese',
233: self::CATALAN => 'catalan',
234: self::CHAMORRO => 'chamorro',
235: self::CHECHEN => 'chechen',
236: self::CHICHEWA => 'chichewa',
237: self::CHINESE => 'chinese',
238: self::CHURCH_SLAVIC => 'church slavic',
239: self::CHUVASH => 'chuvash',
240: self::CORNISH => 'cornish',
241: self::CORSICAN => 'corsican',
242: self::CREE => 'cree',
243: self::CROATIAN => 'croatian',
244: self::CZECH => 'czech',
245: self::DANISH => 'danish',
246: self::DIVEHI => 'divehi',
247: self::DUTCH => 'dutch',
248: self::DZONGKHA => 'dzongkha',
249: self::ENGLISH => 'english',
250: self::ESPERANTO => 'esperanto',
251: self::ESTONIAN => 'estonian',
252: self::EWE => 'ewe',
253: self::FAROESE => 'faroese',
254: self::FIJIAN => 'fijian',
255: self::FINNISH => 'finnish',
256: self::FRENCH => 'french',
257: self::FULAH => 'fulah',
258: self::GAELIC => 'gaelic',
259: self::GALICIAN => 'galician',
260: self::GANDA => 'ganda',
261: self::GEORGIAN => 'georgian',
262: self::GERMAN => 'german',
263: self::GREEK => 'greek',
264: self::GUARANI => 'guaraní',
265: self::GUJARATI => 'gujarati',
266: self::HAITIAN => 'haitian',
267: self::HAUSA => 'hausa',
268: self::HEBREW => 'hebrew',
269: self::HERERO => 'herero',
270: self::HINDI => 'hindi',
271: self::HIRI_MOTU => 'hiri motu',
272: self::HUNGARIAN => 'hungarian',
273: self::ICELANDIC => 'icelandic',
274: self::IDO => 'ido',
275: self::IGBO => 'igbo',
276: self::INDONESIAN => 'indonesian',
277: self::INTERLINGUA => 'interlingua',
278: self::INTERLINGUE => 'interlingue',
279: self::INUIT => 'inuit',
280: self::INUPIAQ => 'inupiaq',
281: self::IRISH => 'irish',
282: self::ITALIAN => 'italian',
283: self::JAPANESE => 'japanese',
284: self::JAVANESE => 'javanese',
285: self::KALAALLISUT => 'kalaallisut',
286: self::KANNADA => 'kannada',
287: self::KANURI => 'kanuri',
288: self::KASHMIRI => 'kashmiri',
289: self::KAZAKH => 'kazakh',
290: self::KHMER => 'khmer',
291: self::KIKUYU => 'kikuyu',
292: self::KINYARWANDA => 'kinyarwanda',
293: self::KIRGHIZ => 'kirghiz',
294: self::KIRUNDI => 'kirundi',
295: self::KOMI => 'komi',
296: self::KONGO => 'kongo',
297: self::KOREAN => 'korean',
298: self::KUANYAMA => 'kuanyama',
299: self::KURDISH => 'kurdish',
300: self::LAO => 'lao',
301: self::LATIN => 'latin',
302: self::LATVIAN => 'latvian',
303: self::LIMBURGISH => 'limburgish',
304: self::LINGALA => 'lingala',
305: self::LITHUANIAN => 'lithuanian',
306: self::LUBA_KATANGA => 'luba-katanga',
307: self::LUXEMBOURGISH => 'luxembourgish',
308: self::MACEDONIAN => 'macedonian',
309: self::MALAGASY => 'malagasy',
310: self::MALAY => 'malay',
311: self::MALAYALAM => 'malayalam',
312: self::MALTESE => 'maltese',
313: self::MANX => 'manx',
314: self::MAORI => 'māori',
315: self::MARATHI => 'marathi',
316: self::MARSHALLESE => 'marshallese',
317: self::MOLDAVIAN => 'moldavian',
318: self::MONGOLIAN => 'mongolian',
319: self::NAURU => 'nauru',
320: self::NAVAJO => 'navajo',
321: self::NDONGA => 'ndonga',
322: self::NEPALI => 'nepali',
323: self::NORTHERN_SAMI => 'northern sami',
324: self::NORTH_NDEBELE => 'north ndebele',
325: self::NORWEGIAN => 'norwegian',
326: self::NORWEGIAN_BOKMAL => 'norwegian bokmål',
327: self::NORWEGIAN_NYNORSK => 'norwegian nynorsk',
328: self::OCCITAN => 'occitan',
329: self::OJIBWA => 'ojibwa',
330: self::ORIYA => 'oriya',
331: self::OROMO => 'oromo',
332: self::OSSETIAN => 'ossetian',
333: self::PALI => 'pāli',
334: self::PANJABI => 'panjabi',
335: self::PASHTO => 'pashto',
336: self::PERSIAN => 'persian',
337: self::POLISH => 'polish',
338: self::PORTUGUESE => 'portuguese',
339: self::QUECHUA => 'quechua',
340: self::RAETO_ROMANCE => 'raeto-romance',
341: self::ROMANIAN => 'romanian',
342: self::RUSSIAN => 'russian',
343: self::RUSYN => 'rusyn',
344: self::SAMOAN => 'samoan',
345: self::SANGO => 'sango',
346: self::SANSKRIT => 'sanskrit',
347: self::SARDINIAN => 'sardinian',
348: self::SERBIAN => 'serbian',
349: self::SERBO_CROATIAN => 'serbo-croatian',
350: self::SHONA => 'shona',
351: self::SICHUAN_YI => 'sichuan yi',
352: self::SINDHI => 'sindhi',
353: self::SINHALA => 'sinhala',
354: self::SLOVAK => 'slovak',
355: self::SLOVENIAN => 'slovenian',
356: self::SOMALI => 'somali',
357: self::SOUTHERN_SOTHO => 'southern sotho',
358: self::SOUTH_NDEBELE => 'south ndebele',
359: self::SPANISH => 'spanish',
360: self::SUNDANESE => 'sundanese',
361: self::SWAHILI => 'swahili',
362: self::SWATI => 'swati',
363: self::SWEDISH => 'swedish',
364: self::TAGALOG => 'tagalog',
365: self::TAHITIAN => 'tahitian',
366: self::TAJIK => 'tajik',
367: self::TAMIL => 'tamil',
368: self::TATAR => 'tatar',
369: self::TELUGU => 'telugu',
370: self::THAI => 'thai',
371: self::TIBETAN => 'tibetan',
372: self::TIGRINYA => 'tigrinya',
373: self::TONGA => 'tonga',
374: self::TSONGA => 'tsonga',
375: self::TSWANA => 'tswana',
376: self::TURKISH => 'turkish',
377: self::TURKMEN => 'turkmen',
378: self::TWI => 'twi',
379: self::UIGHUR => 'uighur',
380: self::UKRAINIAN => 'ukrainian',
381: self::URDU => 'urdu',
382: self::UZBEK => 'uzbek',
383: self::VENDA => 'venda',
384: self::VIETNAMESE => 'vietnamese',
385: self::VOLAPUK => 'volapük',
386: self::WALLOON => 'walloon',
387: self::WELSH => 'welsh',
388: self::WESTERN_FRISIAN => 'western frisian',
389: self::WOLOF => 'wolof',
390: self::XHOSA => 'xhosa',
391: self::YIDDISH => 'yiddish',
392: self::YORUBA => 'yoruba',
393: self::ZHUANG => 'zhuang',
394: self::ZULU => 'zulu',
395: ];
396:
397: /** @var string[] */
398: private static $native = [
399: self::ABKHAZ => 'аҧсуа',
400: self::AFAR => 'afaraf',
401: self::AFRIKAANS => 'afrikaans',
402: self::AKAN => 'akan',
403: self::ALBANIAN => 'shqip',
404: self::AMHARIC => 'አማርኛ',
405: self::ARABIC => 'العربية',
406: self::ARAGONESE => 'aragonés',
407: self::ARMENIAN => 'հայերեն',
408: self::ASSAMESE => 'অসমীয়া',
409: self::AVARIC => 'авар мацӏ',
410: self::AVESTAN => 'avesta',
411: self::AYMARA => 'aymar aru',
412: self::AZERBAIJANI => 'azərbaycan dili',
413: self::BAMBARA => 'bamanankan',
414: self::BASHKIR => 'башҡорт теле',
415: self::BASQUE => 'euskara',
416: self::BELARUSIAN => 'беларуская',
417: self::BENGALI => 'বাংলা',
418: self::BIHARI => 'भोजपुरी',
419: self::BISLAMA => 'bislama',
420: self::BOSNIAN => 'bosanski jezik',
421: self::BRETON => 'brezhoneg',
422: self::BULGARIAN => 'български език',
423: self::BURMESE => 'burmese', ///
424: self::CATALAN => 'català',
425: self::CHAMORRO => 'chamoru',
426: self::CHECHEN => 'нохчийн мотт',
427: self::CHICHEWA => 'chicheŵa; chinyanja',
428: self::CHINESE => '中文',
429: self::CHURCH_SLAVIC => 'staroslověnština',
430: self::CHUVASH => 'чӑваш чӗлхи',
431: self::CORNISH => 'kernewek',
432: self::CORSICAN => 'corsu',
433: self::CREE => 'ᓀᐦᐃᔭᐍᐏᐣ',
434: self::CROATIAN => 'hrvatski',
435: self::CZECH => 'čeština',
436: self::DANISH => 'dansk',
437: self::DIVEHI => 'ދިވެހި',
438: self::DUTCH => 'nederlands',
439: self::DZONGKHA => 'རྫོང་ཁ',
440: self::ENGLISH => 'english',
441: self::ESPERANTO => 'esperanto',
442: self::ESTONIAN => 'eesti keel',
443: self::EWE => 'ɛʋɛgbɛ',
444: self::FAROESE => 'føroyskt',
445: self::FIJIAN => 'vosa vakaviti',
446: self::FINNISH => 'suomen kieli',
447: self::FRENCH => 'français',
448: self::FULAH => 'fulfulde',
449: self::GAELIC => 'gàidhlig',
450: self::GALICIAN => 'galego',
451: self::GANDA => 'luganda',
452: self::GEORGIAN => 'ქართული',
453: self::GERMAN => 'deutsch',
454: self::GREEK => 'ελληνικά',
455: self::GUARANI => 'avañe\'ẽ',
456: self::GUJARATI => 'ગુજરાતી',
457: self::HAITIAN => 'kreyòl ayisyen',
458: self::HAUSA => 'هَوُسَ',
459: self::HEBREW => 'עברית',
460: self::HERERO => 'otjiherero',
461: self::HINDI => 'हिन्दी',
462: self::HIRI_MOTU => 'hiri motu',
463: self::HUNGARIAN => 'magyar',
464: self::ICELANDIC => 'íslenska',
465: self::IDO => 'ido',
466: self::IGBO => 'igbo',
467: self::INDONESIAN => 'bahasa indonesia',
468: self::INTERLINGUA => 'interlingua',
469: self::INTERLINGUE => 'interlingue',
470: self::INUIT => 'ᐃᓄᒃᑎᑐᑦ',
471: self::INUPIAQ => 'iñupiaq',
472: self::IRISH => 'gaeilge',
473: self::ITALIAN => 'italiano',
474: self::JAPANESE => '日本語',
475: self::JAVANESE => 'basa jawa',
476: self::KALAALLISUT => 'kalaallisut',
477: self::KANNADA => 'ಕನ್ನಡ',
478: self::KANURI => 'kanuri',
479: self::KASHMIRI => 'कश्मीरी; كشميري',
480: self::KAZAKH => 'қазақ тілі',
481: self::KHMER => 'ភាសាខ្មែរ',
482: self::KIKUYU => 'gĩkũyũ',
483: self::KINYARWANDA => 'kinyarwanda',
484: self::KIRGHIZ => 'кыргыз тили',
485: self::KIRUNDI => 'kirundi',
486: self::KOMI => 'коми кыв',
487: self::KONGO => 'kikongo',
488: self::KOREAN => '한국어',
489: self::KUANYAMA => 'kuanyama',
490: self::KURDISH => 'kurdî; كوردی',
491: self::LAO => 'ພາສາລາວ',
492: self::LATIN => 'latine',
493: self::LATVIAN => 'latviešu valoda',
494: self::LIMBURGISH => 'limburgs',
495: self::LINGALA => 'lingála',
496: self::LITHUANIAN => 'lietuvių kalba',
497: self::LUBA_KATANGA => 'luba-katanga',
498: self::LUXEMBOURGISH => 'lëtzebuergesch',
499: self::MACEDONIAN => 'македонски јазик',
500: self::MALAGASY => 'malagasy fiteny',
501: self::MALAY => 'bahasa melayu; بهاس ملايو',
502: self::MALAYALAM => 'മലയാളം',
503: self::MALTESE => 'malti',
504: self::MANX => 'ghaelg',
505: self::MAORI => 'te reo māori',
506: self::MARATHI => 'मराठी',
507: self::MARSHALLESE => 'kajin m̧ajeļ',
508: self::MOLDAVIAN => 'лимба молдовеняскэ',
509: self::MONGOLIAN => 'монгол',
510: self::NAURU => 'ekakairũ naoero',
511: self::NAVAJO => 'diné bizaad; dinékʼehǰí',
512: self::NDONGA => 'owambo',
513: self::NEPALI => 'नेपाली',
514: self::NORTHERN_SAMI => 'davvisámegiella',
515: self::NORTH_NDEBELE => 'isindebele',
516: self::NORWEGIAN => 'norsk',
517: self::NORWEGIAN_BOKMAL => 'norsk bokmål',
518: self::NORWEGIAN_NYNORSK => 'norsk nynorsk',
519: self::OCCITAN => 'occitan',
520: self::OJIBWA => 'ᐊᓂᔑᓈᐯᒧᐎᓐ',
521: self::ORIYA => 'ଓଡ଼ିଆ',
522: self::OROMO => 'afaan oromoo',
523: self::OSSETIAN => 'ирон æвзаг',
524: self::PALI => 'पािऴ',
525: self::PANJABI => 'ਪੰਜਾਬੀ; پنجابی',
526: self::PASHTO => 'پښتو',
527: self::PERSIAN => 'فارسی',
528: self::POLISH => 'polski',
529: self::PORTUGUESE => 'português',
530: self::QUECHUA => 'runa simi; kichwa',
531: self::RAETO_ROMANCE => 'rumantsch grischun',
532: self::ROMANIAN => 'română',
533: self::RUSSIAN => 'русский язык',
534: self::RUSYN => 'русинськый язык',
535: self::SAMOAN => 'gagana fa\'a samoa',
536: self::SANGO => 'yângâ tî sängö',
537: self::SANSKRIT => 'संस्कृतम्',
538: self::SARDINIAN => 'sardu',
539: self::SERBIAN => 'српски језик',
540: self::SERBO_CROATIAN => 'српскохрватски',
541: self::SHONA => 'chishona',
542: self::SICHUAN_YI => 'ꆇꉙ',
543: self::SINDHI => 'सिन्धी; سنڌي، سندھی',
544: self::SINHALA => 'සිංහල',
545: self::SLOVAK => 'slovenčina',
546: self::SLOVENIAN => 'slovenščina',
547: self::SOMALI => 'soomaaliga; af soomaali',
548: self::SOUTHERN_SOTHO => 'sesotho',
549: self::SOUTH_NDEBELE => 'ndébélé',
550: self::SPANISH => 'español',
551: self::SUNDANESE => 'basa sunda',
552: self::SWAHILI => 'kiswahili',
553: self::SWATI => 'siswati',
554: self::SWEDISH => 'svenska',
555: self::TAGALOG => 'tagalog',
556: self::TAHITIAN => 'reo mā`ohi',
557: self::TAJIK => 'тоҷикӣ; toğikī; تاجیکی',
558: self::TAMIL => 'தமிழ்',
559: self::TATAR => 'татарча; tatarça; تاتارچا',
560: self::TELUGU => 'తెలుగు',
561: self::THAI => 'ไทย',
562: self::TIBETAN => 'བོད་ཡིག',
563: self::TIGRINYA => 'ትግርኛ',
564: self::TONGA => 'faka tonga',
565: self::TSONGA => 'xitsonga',
566: self::TSWANA => 'setswana',
567: self::TURKISH => 'türkçe',
568: self::TURKMEN => 'türkmen; түркмен',
569: self::TWI => 'twi',
570: self::UIGHUR => 'uyƣurqə; ئۇيغۇرچ ',
571: self::UKRAINIAN => 'українська мова',
572: self::URDU => 'اردو',
573: self::UZBEK => 'o\'zbek; ўзбек; أۇزبېك',
574: self::VENDA => 'tshivenḓa',
575: self::VIETNAMESE => 'tiếng việt',
576: self::VOLAPUK => 'volapük',
577: self::WALLOON => 'walon',
578: self::WELSH => 'cymraeg',
579: self::WESTERN_FRISIAN => 'frysk',
580: self::WOLOF => 'wollof',
581: self::XHOSA => 'isixhosa',
582: self::YIDDISH => 'ייִדיש',
583: self::YORUBA => 'yorùbá',
584: self::ZHUANG => 'saɯ cueŋƅ',
585: self::ZULU => 'isizulu',
586: ];
587:
588: /**
589: * @var string[]
590: */
591: private static $idents = [
592: self::ABKHAZ => 'abkhaz',
593: self::AFAR => 'afar',
594: self::AFRIKAANS => 'afrikaans',
595: self::AKAN => 'akan',
596: self::ALBANIAN => 'albanian',
597: self::AMHARIC => 'amharic',
598: self::ARABIC => 'arabic',
599: self::ARAGONESE => 'aragonese',
600: self::ARMENIAN => 'armenian',
601: self::ASSAMESE => 'assamese',
602: self::AVARIC => 'avaric',
603: self::AVESTAN => 'avestan',
604: self::AYMARA => 'aymara',
605: self::AZERBAIJANI => 'azerbaijani',
606: self::BAMBARA => 'bambara',
607: self::BASHKIR => 'bashkir',
608: self::BASQUE => 'basque',
609: self::BELARUSIAN => 'belarusian',
610: self::BENGALI => 'bengali',
611: self::BIHARI => 'bihari',
612: self::BISLAMA => 'bislama',
613: self::BOSNIAN => 'bosnian',
614: self::BRETON => 'breton',
615: self::BULGARIAN => 'bulgarian',
616: self::BURMESE => 'burmese',
617: self::CATALAN => 'catalan',
618: self::CHAMORRO => 'chamorro',
619: self::CHECHEN => 'chechen',
620: self::CHICHEWA => 'chichewa',
621: self::CHINESE => 'chinese',
622: self::CHURCH_SLAVIC => 'church-slavic',
623: self::CHUVASH => 'chuvash',
624: self::CORNISH => 'cornish',
625: self::CORSICAN => 'corsican',
626: self::CREE => 'cree',
627: self::CROATIAN => 'croatian',
628: self::CZECH => 'czech',
629: self::DANISH => 'danish',
630: self::DIVEHI => 'divehi',
631: self::DUTCH => 'dutch',
632: self::DZONGKHA => 'dzongkha',
633: self::ENGLISH => 'english',
634: self::ESPERANTO => 'esperanto',
635: self::ESTONIAN => 'estonian',
636: self::EWE => 'ewe',
637: self::FAROESE => 'faroese',
638: self::FIJIAN => 'fijian',
639: self::FINNISH => 'finnish',
640: self::FRENCH => 'french',
641: self::FULAH => 'fulah',
642: self::GAELIC => 'gaelic',
643: self::GALICIAN => 'galician',
644: self::GANDA => 'ganda',
645: self::GEORGIAN => 'georgian',
646: self::GERMAN => 'german',
647: self::GREEK => 'greek',
648: self::GUARANI => 'guarani',
649: self::GUJARATI => 'gujarati',
650: self::HAITIAN => 'haitian',
651: self::HAUSA => 'hausa',
652: self::HEBREW => 'hebrew',
653: self::HERERO => 'herero',
654: self::HINDI => 'hindi',
655: self::HIRI_MOTU => 'hiri-motu',
656: self::HUNGARIAN => 'hungarian',
657: self::ICELANDIC => 'icelandic',
658: self::IDO => 'ido',
659: self::IGBO => 'igbo',
660: self::INDONESIAN => 'indonesian',
661: self::INTERLINGUA => 'interlingua',
662: self::INTERLINGUE => 'interlingue',
663: self::INUIT => 'inuit',
664: self::INUPIAQ => 'inupiaq',
665: self::IRISH => 'irish',
666: self::ITALIAN => 'italian',
667: self::JAPANESE => 'japanese',
668: self::JAVANESE => 'javanese',
669: self::KALAALLISUT => 'kalaallisut',
670: self::KANNADA => 'kannada',
671: self::KANURI => 'kanuri',
672: self::KASHMIRI => 'kashmiri',
673: self::KAZAKH => 'kazakh',
674: self::KHMER => 'khmer',
675: self::KIKUYU => 'kikuyu',
676: self::KINYARWANDA => 'kinyarwanda',
677: self::KIRGHIZ => 'kirghiz',
678: self::KIRUNDI => 'kirundi',
679: self::KOMI => 'komi',
680: self::KONGO => 'kongo',
681: self::KOREAN => 'korean',
682: self::KUANYAMA => 'kuanyama',
683: self::KURDISH => 'kurdish',
684: self::LAO => 'lao',
685: self::LATIN => 'latin',
686: self::LATVIAN => 'latvian',
687: self::LIMBURGISH => 'limburgish',
688: self::LINGALA => 'lingala',
689: self::LITHUANIAN => 'lithuanian',
690: self::LUBA_KATANGA => 'luba-katanga',
691: self::LUXEMBOURGISH => 'luxembourgish',
692: self::MACEDONIAN => 'macedonian',
693: self::MALAGASY => 'malagasy',
694: self::MALAY => 'malay',
695: self::MALAYALAM => 'malayalam',
696: self::MALTESE => 'maltese',
697: self::MANX => 'manx',
698: self::MAORI => 'aori',
699: self::MARATHI => 'marathi',
700: self::MARSHALLESE => 'marshallese',
701: self::MOLDAVIAN => 'moldavian',
702: self::MONGOLIAN => 'mongolian',
703: self::NAURU => 'nauru',
704: self::NAVAJO => 'navajo',
705: self::NDONGA => 'ndonga',
706: self::NEPALI => 'nepali',
707: self::NORTHERN_SAMI => 'northern-sami',
708: self::NORTH_NDEBELE => 'north-ndebele',
709: self::NORWEGIAN => 'norwegian',
710: self::NORWEGIAN_BOKMAL => 'norwegian-bokmal',
711: self::NORWEGIAN_NYNORSK => 'norwegian-nynorsk',
712: self::OCCITAN => 'occitan',
713: self::OJIBWA => 'ojibwa',
714: self::ORIYA => 'oriya',
715: self::OROMO => 'oromo',
716: self::OSSETIAN => 'ossetian',
717: self::PALI => 'pali',
718: self::PANJABI => 'panjabi',
719: self::PASHTO => 'pashto',
720: self::PERSIAN => 'persian',
721: self::POLISH => 'polish',
722: self::PORTUGUESE => 'portuguese',
723: self::QUECHUA => 'quechua',
724: self::RAETO_ROMANCE => 'raeto-romance',
725: self::ROMANIAN => 'romanian',
726: self::RUSSIAN => 'russian',
727: self::RUSYN => 'rusyn',
728: self::SAMOAN => 'samoan',
729: self::SANGO => 'sango',
730: self::SANSKRIT => 'sanskrit',
731: self::SARDINIAN => 'sardinian',
732: self::SERBIAN => 'serbian',
733: self::SERBO_CROATIAN => 'serbo-croatian',
734: self::SHONA => 'shona',
735: self::SICHUAN_YI => 'sichuan-yi',
736: self::SINDHI => 'sindhi',
737: self::SINHALA => 'sinhala',
738: self::SLOVAK => 'slovak',
739: self::SLOVENIAN => 'slovenian',
740: self::SOMALI => 'somali',
741: self::SOUTHERN_SOTHO => 'southern-sotho',
742: self::SOUTH_NDEBELE => 'south-ndebele',
743: self::SPANISH => 'spanish',
744: self::SUNDANESE => 'sundanese',
745: self::SWAHILI => 'swahili',
746: self::SWATI => 'swati',
747: self::SWEDISH => 'swedish',
748: self::TAGALOG => 'tagalog',
749: self::TAHITIAN => 'tahitian',
750: self::TAJIK => 'tajik',
751: self::TAMIL => 'tamil',
752: self::TATAR => 'tatar',
753: self::TELUGU => 'telugu',
754: self::THAI => 'thai',
755: self::TIBETAN => 'tibetan',
756: self::TIGRINYA => 'tigrinya',
757: self::TONGA => 'tonga',
758: self::TSONGA => 'tsonga',
759: self::TSWANA => 'tswana',
760: self::TURKISH => 'turkish',
761: self::TURKMEN => 'turkmen',
762: self::TWI => 'twi',
763: self::UIGHUR => 'uighur',
764: self::UKRAINIAN => 'ukrainian',
765: self::URDU => 'urdu',
766: self::UZBEK => 'uzbek',
767: self::VENDA => 'venda',
768: self::VIETNAMESE => 'vietnamese',
769: self::VOLAPUK => 'volapuk',
770: self::WALLOON => 'walloon',
771: self::WELSH => 'welsh',
772: self::WESTERN_FRISIAN => 'western-frisian',
773: self::WOLOF => 'wolof',
774: self::XHOSA => 'xhosa',
775: self::YIDDISH => 'yiddish',
776: self::YORUBA => 'yoruba',
777: self::ZHUANG => 'zhuang',
778: self::ZULU => 'zulu',
779: ];
780:
781: public function getName(): string
782: {
783: return self::$names[$this->getValue()];
784: }
785:
786: public function getNativeName(): string
787: {
788: return self::$native[$this->getValue()];
789: }
790:
791: public function getIdent(): string
792: {
793: return self::$idents[$this->getValue()];
794: }
795:
796: public static function getByIdent(string $ident): self
797: {
798: return self::get(array_search($ident, self::$idents));
799: }
800:
801: public static function validateValue(string &$value): bool
802: {
803: $value = strtolower($value);
804:
805: return parent::validateValue($value);
806: }
807:
808: }
| 18 % | Language\Locale\Locale.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: use Dogma\Arr;
13: use Dogma\Check;
14: use Dogma\Country\Country;
15: use Dogma\Language\Collator;
16: use Dogma\Language\Language;
17: use Dogma\Language\Script;
18: use Dogma\Money\Currency;
19: use Dogma\Str;
20: use Dogma\Type;
21:
22: class Locale
23: {
24: use \Dogma\StrictBehaviorMixin;
25:
26: /** @var self[] */
27: private static $instances = [];
28:
29: /** @var string */
30: private $value;
31:
32: /** @var string[]|string[][] */
33: private $components;
34:
35: final private function __construct(string $value, array $components)
36: {
37: $this->value = $value;
38: $this->components = $components;
39: }
40:
41: public static function get(string $value): self
42: {
43: $value = \Locale::canonicalize($value);
44:
45: if (isset(self::$instances[$value])) {
46: return self::$instances[$value];
47: } else {
48: $components = \Locale::parseLocale($value);
49: $keywords = \Locale::getKeywords($value);
50: if ($keywords) {
51: $components['keywords'] = $keywords;
52: }
53: $instance = new self($value, $components);
54: self::$instances[$value] = $instance;
55: return $instance;
56: }
57: }
58:
59: public static function getDefault(): self
60: {
61: return self::get(\Locale::getDefault());
62: }
63:
64: /**
65: * @param \Dogma\Language\Language $language
66: * @param \Dogma\Country\Country|null $country
67: * @param \Dogma\Language\Script|null $script
68: * @param string[] $variants
69: * @param string[] $private
70: * @param string[] $keywords
71: * @return self
72: */
73: public static function create(
74: Language $language,
75: ?Country $country = null,
76: ?Script $script = null,
77: array $variants = [],
78: array $private = [],
79: array $keywords = []
80: ): self
81: {
82: $components = [
83: 'language' => $language->getValue(),
84: 'region' => $country ? $country->getValue() : null,
85: 'script' => $script ? $script->getValue() : null,
86: ];
87: foreach (array_values($variants) as $n => $value) {
88: $components['variant' . $n] = $value;
89: }
90: foreach (array_values($private) as $n => $value) {
91: $components['private' . $n] = $value;
92: }
93:
94: $value = \Locale::composeLocale(array_filter($components));
95: if ($keywords) {
96: $value .= '@' . implode(';', Arr::mapPairs($keywords, function (string $key, string $value) {
97: return $key . '=' . $value;
98: }));
99: }
100: $value = \Locale::canonicalize($value);
101:
102: if (isset(self::$instances[$value])) {
103: return self::$instances[$value];
104: } else {
105: $components['keywords'] = $keywords;
106: $instance = new self($value, $components);
107: self::$instances[$value] = $instance;
108: return $instance;
109: }
110: }
111:
112: public function getCollator(): Collator
113: {
114: return new Collator($this);
115: }
116:
117: /**
118: * @param string|\Dogma\Language\Locale\Locale $locale
119: * @return bool
120: */
121: public function matches($locale): bool
122: {
123: Check::types($locale, [Type::STRING, self::class]);
124:
125: if (is_string($locale)) {
126: $locale = self::get($locale);
127: }
128:
129: return \Locale::filterMatches($this->value, $locale->getValue(), false);
130: }
131:
132: /**
133: * @param \Dogma\Language\Locale\Locale[]|string[] $locales
134: * @param \Dogma\Language\Locale\Locale|string $default
135: * @return self|null
136: */
137: public function findBestMatch(array $locales, $default = null): ?self
138: {
139: Check::types($default, [Type::STRING, self::class, Type::NULL]);
140:
141: if ($default === null) {
142: // work around bug when lookup does not work at all without default value
143: $default = reset($locales);
144: }
145: if (is_string($default)) {
146: $default = self::get($default);
147: }
148:
149: foreach ($locales as $i => $locale) {
150: Check::types($locale, [Type::STRING, self::class]);
151: if (is_string($locale)) {
152: $locales[$i] = \Locale::canonicalize($locale);
153: } else {
154: /** @var \Dogma\Language\Locale\Locale $locale */
155: $locale[$i] = $locale->getValue();
156: }
157: }
158:
159: $match = \Locale::lookup($locales, $this->value, false, $default->getValue());
160:
161: return $match ? self::get($match) : null;
162: }
163:
164: public function getValue(): string
165: {
166: return $this->value;
167: }
168:
169: public function getLanguage(): ?Language
170: {
171: if (empty($this->components['language'])) {
172: return null;
173: }
174: return Language::get($this->components['language']);
175: }
176:
177: public function getScript(): ?Script
178: {
179: if (empty($this->components['script'])) {
180: return null;
181: }
182: return Script::get($this->components['script']);
183: }
184:
185: public function getCountry(): ?Country
186: {
187: if (empty($this->components['region'])) {
188: return null;
189: }
190: return Country::get($this->components['region']);
191: }
192:
193: /**
194: * @return string[]
195: */
196: public function getVariants(): array
197: {
198: return \Locale::getAllVariants($this->value);
199: }
200:
201: public function getVariant(int $n): ?string
202: {
203: $key = 'variant' . $n;
204: if (empty($this->components[$key])) {
205: return null;
206: }
207: return $this->components[$key];
208: }
209:
210: public function hasVariant(string $variant): bool
211: {
212: return Arr::contains($this->getVariants(), $variant);
213: }
214:
215: /**
216: * @return string[]
217: */
218: public function getPrivates(): array
219: {
220: $privates = [];
221: foreach ($this->components as $key => $component) {
222: if (preg_match('/^private\\d+$/', $key)) {
223: // work around bug, when last private variant is returned with keywords
224: $privates[] = Str::toFirst($component, '@');
225: }
226: }
227: return $privates;
228: }
229:
230: public function getPrivate(int $n): ?string
231: {
232: $key = 'private' . $n;
233: if (empty($this->components[$key])) {
234: return null;
235: }
236: // work around bug, when last private variant is returned with keywords
237: return Str::toFirst($this->components[$key], '@');
238: }
239:
240: /**
241: * @return string[]
242: */
243: public function getKeywords(): array
244: {
245: return isset($this->components['keywords']) ? $this->components['keywords'] : [];
246: }
247:
248: public function getKeyword(string $keyword): ?string
249: {
250: return isset($this->components['keywords'][$keyword]) ? $this->components['keywords'][$keyword] : null;
251: }
252:
253: public function getCurrency(): ?Currency
254: {
255: $value = $this->getKeyword(LocaleKeyword::CURRENCY);
256:
257: return $value ? Currency::get($value) : null;
258: }
259:
260: public function getNumbers(): ?LocaleNumbers
261: {
262: $value = $this->getKeyword(LocaleKeyword::NUMBERS);
263:
264: return $value ? LocaleNumbers::get($value) : null;
265: }
266:
267: public function getCalendar(): ?LocaleCalendar
268: {
269: $value = $this->getKeyword(LocaleKeyword::CALENDAR);
270:
271: return $value ? LocaleCalendar::get($value) : null;
272: }
273:
274: public function getCollation(): ?LocaleCollation
275: {
276: $value = $this->getKeyword(LocaleKeyword::COLLATION);
277:
278: return $value ? LocaleCollation::get($value) : null;
279: }
280:
281: /**
282: * @return string[]
283: */
284: public function getCollationOptions(): array
285: {
286: $options = [];
287: foreach (LocaleKeyword::getCollationOptions() as $keyword => $class) {
288: $value = $this->getKeyword($keyword);
289: if ($value !== null) {
290: /** @var \Dogma\Language\Locale\LocaleCollationOption $class */
291: $options[$keyword] = $class::get($value);
292: }
293: }
294: return $options;
295: }
296:
297: public function removeCollation(): self
298: {
299: $keywords = Arr::diffKeys($this->getKeywords(), LocaleKeyword::getCollationOptions());
300: unset($keywords[LocaleKeyword::COLLATION]);
301:
302: return self::create(
303: $this->getLanguage(),
304: $this->getCountry(),
305: $this->getScript(),
306: $this->getVariants(),
307: $this->getPrivates(),
308: $keywords
309: );
310: }
311:
312: public static function getValueRegexp(): string
313: {
314: static $regexp;
315:
316: if (!$regexp) {
317: // language_Script_COUNTRY_VARIANT_VARIANT...@keyword=value;keyword=value...
318: $regexp = sprintf(
319: '%s(?:_(?:%s))?(?:_(?:%s))?(?:_(?:%s))*(?:@(?:%s)=[a-zA-Z0-9-](?:;(?:%s)=[a-zA-Z0-9-])*)?',
320: Language::getValueRegexp(),
321: Script::getValueRegexp(),
322: Country::getValueRegexp(),
323: LocaleVariant::getValueRegexp(),
324: LocaleKeyword::getValueRegexp(),
325: LocaleKeyword::getValueRegexp()
326: );
327: }
328: return $regexp;
329: }
330:
331: }
| 0 % | Language\Locale\LocaleCalendar.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: // spell-check-ignore: roc ROC
11:
12: namespace Dogma\Language\Locale;
13:
14: class LocaleCalendar extends \Dogma\Enum\StringEnum
15: {
16:
17: public const BUDDHIST = 'buddhist';
18: public const CHINESE = 'chinese';
19: public const COPTIC = 'coptic';
20: public const DANGI = 'dangi';
21: public const ETHIOPIC = 'ethiopic';
22: public const ETHIOPIC_AMETE_ALEM = 'ethiopic-amete-alem';
23: public const GREGORIAN = 'gregorian';
24: public const HEBREW = 'hebrew';
25: public const INDIAN = 'indian';
26: public const ISLAMIC = 'islamic';
27: public const ISLAMIC_CIVIL = 'islamic-civil';
28: public const ISO8601 = 'iso8601';
29: public const JAPANESE = 'japanese';
30: public const PERSIAN = 'persian';
31: public const ROC = 'roc';
32:
33: public static function validateValue(string &$value): bool
34: {
35: $value = strtolower($value);
36:
37: return parent::validateValue($value);
38: }
39:
40: }
| 0 % | Language\Locale\LocaleColAlternate.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: use Dogma\Language\Collator;
13:
14: class LocaleColAlternate extends \Dogma\Enum\StringEnum implements \Dogma\Language\Locale\LocaleCollationOption
15: {
16:
17: public const NON_IGNORABLE = 'non-ignorable';
18: public const SHIFTED = 'shifted';
19:
20: public static function validateValue(string &$value): bool
21: {
22: $value = strtolower($value);
23:
24: return parent::validateValue($value);
25: }
26:
27: public function getCollatorValue(): int
28: {
29: return [
30: self::NON_IGNORABLE => Collator::NON_IGNORABLE,
31: self::SHIFTED => Collator::SHIFTED,
32: ][$this->getValue()];
33: }
34:
35: }
| 0 % | Language\Locale\LocaleColBackwards.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: use Dogma\Language\Collator;
13:
14: class LocaleColBackwards extends \Dogma\Enum\StringEnum implements \Dogma\Language\Locale\LocaleCollationOption
15: {
16:
17: public const YES = 'yes';
18: public const NO = 'no';
19:
20: public static function validateValue(string &$value): bool
21: {
22: $value = strtolower($value);
23:
24: return parent::validateValue($value);
25: }
26:
27: public function getCollatorValue(): int
28: {
29: return [
30: self::YES => Collator::ON,
31: self::NO => Collator::OFF,
32: ][$this->getValue()];
33: }
34:
35: }
| 0 % | Language\Locale\LocaleColCaseFirst.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: use Dogma\Language\Collator;
13:
14: class LocaleColCaseFirst extends \Dogma\Enum\StringEnum implements \Dogma\Language\Locale\LocaleCollationOption
15: {
16:
17: public const UPPER = 'upper';
18: public const LOWER = 'lower';
19: public const NO = 'no';
20:
21: public static function validateValue(string &$value): bool
22: {
23: $value = strtolower($value);
24:
25: return parent::validateValue($value);
26: }
27:
28: public function getCollatorValue(): int
29: {
30: return [
31: self::UPPER => Collator::UPPER_FIRST,
32: self::LOWER => Collator::LOWER_FIRST,
33: self::NO => Collator::OFF,
34: ][$this->getValue()];
35: }
36:
37: }
| 0 % | Language\Locale\LocaleColCaseLevel.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: use Dogma\Language\Collator;
13:
14: class LocaleColCaseLevel extends \Dogma\Enum\StringEnum implements \Dogma\Language\Locale\LocaleCollationOption
15: {
16:
17: public const YES = 'yes';
18: public const NO = 'no';
19:
20: public static function validateValue(string &$value): bool
21: {
22: $value = strtolower($value);
23:
24: return parent::validateValue($value);
25: }
26:
27: public function getCollatorValue(): int
28: {
29: return [
30: self::YES => Collator::ON,
31: self::NO => Collator::OFF,
32: ][$this->getValue()];
33: }
34:
35: }
| 0 % | Language\Locale\LocaleColHiraganaQuaternary.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: use Dogma\Language\Collator;
13:
14: class LocaleColHiraganaQuaternary extends \Dogma\Enum\StringEnum implements \Dogma\Language\Locale\LocaleCollationOption
15: {
16:
17: public const YES = 'yes';
18: public const NO = 'no';
19:
20: public static function validateValue(string &$value): bool
21: {
22: $value = strtolower($value);
23:
24: return parent::validateValue($value);
25: }
26:
27: public function getCollatorValue(): int
28: {
29: return [
30: self::YES => Collator::ON,
31: self::NO => Collator::OFF,
32: ][$this->getValue()];
33: }
34:
35: }
| 0 % | Language\Locale\LocaleCollation.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: // spell-check-ignore: big5han ducet DUCET eor EOR phonebook PHONEBOOK searchjl SEARCHJL UNIHAN unihan ZHUYIN zhuyin
11:
12: namespace Dogma\Language\Locale;
13:
14: class LocaleCollation extends \Dogma\Enum\StringEnum
15: {
16:
17: public const BIG5 = 'big5han';
18: public const DICTIONARY = 'dictionary';
19: public const DUCET = 'ducet';
20: public const EOR = 'eor';
21: public const GB2312 = 'gb2312han';
22: public const PHONEBOOK = 'phonebook';
23: public const PHONETIC = 'phonetic';
24: public const PINYIN = 'pinyin';
25: public const REFORMED = 'reformed';
26: public const SEARCH = 'search';
27: public const SEARCHJL = 'searchjl';
28: public const STANDARD = 'standard';
29: public const STOKE = 'stroke';
30: public const TRADITIONAL = 'traditional';
31: public const UNIHAN = 'unihan';
32: public const ZHUYIN = 'zhuyin';
33:
34: public static function validateValue(string &$value): bool
35: {
36: $value = strtolower($value);
37:
38: return parent::validateValue($value);
39: }
40:
41: }
| 0 % | Language\Locale\LocaleCollationOption.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: use Dogma\Enum\StringEnum;
13:
14: interface LocaleCollationOption
15: {
16:
17: /**
18: * @param string $value
19: * @return \Dogma\Language\Locale\LocaleCollationOption
20: */
21: public static function get(string $value): StringEnum;
22:
23: public function getCollatorValue(): int;
24:
25: }
| 0 % | Language\Locale\LocaleColNormalization.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: use Dogma\Language\Collator;
13:
14: class LocaleColNormalization extends \Dogma\Enum\StringEnum implements \Dogma\Language\Locale\LocaleCollationOption
15: {
16:
17: public const YES = 'yes';
18: public const NO = 'no';
19:
20: public static function validateValue(string &$value): bool
21: {
22: $value = strtolower($value);
23:
24: return parent::validateValue($value);
25: }
26:
27: public function getCollatorValue(): int
28: {
29: return [
30: self::YES => Collator::ON,
31: self::NO => Collator::OFF,
32: ][$this->getValue()];
33: }
34:
35: }
| 0 % | Language\Locale\LocaleColNumeric.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: use Dogma\Language\Collator;
13:
14: class LocaleColNumeric extends \Dogma\Enum\StringEnum implements \Dogma\Language\Locale\LocaleCollationOption
15: {
16:
17: public const YES = 'yes';
18: public const NO = 'no';
19:
20: public static function validateValue(string &$value): bool
21: {
22: $value = strtolower($value);
23:
24: return parent::validateValue($value);
25: }
26:
27: public function getCollatorValue(): int
28: {
29: return [
30: self::YES => Collator::ON,
31: self::NO => Collator::OFF,
32: ][$this->getValue()];
33: }
34:
35: }
| 0 % | Language\Locale\LocaleColStrength.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: use Collator;
13:
14: class LocaleColStrength extends \Dogma\Enum\StringEnum implements \Dogma\Language\Locale\LocaleCollationOption
15: {
16:
17: public const PRIMARY = 'primary';
18: public const SECONDARY = 'secondary';
19: public const TERTIARY = 'tertiary';
20: public const QUATERNARY = 'quaternary';
21: public const IDENTICAL = 'identical';
22:
23: public static function validateValue(string &$value): bool
24: {
25: $value = strtolower($value);
26:
27: return parent::validateValue($value);
28: }
29:
30: public function getCollatorValue(): int
31: {
32: return [
33: self::PRIMARY => Collator::PRIMARY,
34: self::SECONDARY => Collator::SECONDARY,
35: self::TERTIARY => Collator::TERTIARY,
36: self::QUATERNARY => Collator::TERTIARY,
37: self::IDENTICAL => Collator::IDENTICAL,
38: ][$this->getValue()];
39: }
40:
41: }
| 0 % | Language\Locale\LocaleKeyword.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: // spell-check-ignore: colalternate colbackwards colcasefirst colhiraganaquaternary colnormalization colnumeric colstrength
11:
12: namespace Dogma\Language\Locale;
13:
14: class LocaleKeyword extends \Dogma\Enum\PartialStringEnum
15: {
16:
17: public const CALENDAR = 'calendar';
18: public const COLLATION = 'collation';
19: public const CURRENCY = 'currency';
20: public const NUMBERS = 'numbers';
21:
22: public const COL_ALTERNATE = 'colalternate';
23: public const COL_BACKWARDS = 'colbackwards';
24: public const COL_CASE_FIRST = 'colcasefirst';
25: public const COL_HIRAGANA_QUATERNARY = 'colhiraganaquaternary';
26: public const COL_NORMALIZATION = 'colnormalization';
27: public const COL_NUMERIC = 'colnumeric';
28: public const COL_STRENGTH = 'colstrength';
29:
30: /**
31: * @return string[]
32: */
33: public static function getCollationOptions(): array
34: {
35: return [
36: self::COL_ALTERNATE => LocaleColAlternate::class,
37: self::COL_BACKWARDS => LocaleColBackwards::class,
38: self::COL_CASE_FIRST => LocaleColCaseFirst::class,
39: self::COL_HIRAGANA_QUATERNARY => LocaleColHiraganaQuaternary::class,
40: self::COL_NORMALIZATION => LocaleColNormalization::class,
41: self::COL_NUMERIC => LocaleColNumeric::class,
42: self::COL_STRENGTH => LocaleColStrength::class,
43: ];
44: }
45:
46: public static function validateValue(string &$value): bool
47: {
48: $value = strtolower($value);
49:
50: return parent::validateValue($value);
51: }
52:
53: public static function getValueRegexp(): string
54: {
55: return '[a-z]+';
56: }
57:
58: }
| 0 % | Language\Locale\LocaleNumbers.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: class LocaleNumbers extends \Dogma\Enum\StringEnum
13: {
14:
15: public const ARABIC_INDIC = 'arab';
16: public const ESTENDED_ARABIC_INDIC = 'arabext';
17: public const ARMENIAN = 'armn';
18: public const ARMENIAN_LOWERCASE = 'armnlow';
19: public const BALINESE = 'bali';
20: public const BENGALI = 'beng';
21: public const DEVANAGARI = 'deva';
22: public const ETHIOPIC = 'ethi';
23: public const FINANCIAL = 'finance';
24: public const FULL_WIDTH = 'fullwide';
25: public const GEORGIAN = 'geor';
26: public const GREEK = 'grek';
27: public const GREEK_LOWERCASE = 'greklow';
28: public const GUJARATI = 'gujr';
29: public const GURMUKHI = 'guru';
30: public const CHINESE_DECIMAL = 'hanidec';
31: public const SIMPLIFIES_CHINESE = 'hans';
32: public const SIMPLIFIES_CHINESE_FINANCIAL = 'hansfin';
33: public const TRADITIONAL_CHINESE = 'hant';
34: public const TRADITIONAL_CHINESE_FINANCIAL = 'hantfin';
35: public const HEBREW = 'hebr';
36: public const JAVANESE = 'java';
37: public const JAPANESE = 'jpan';
38: public const JAPANESE_FINANCIAL = 'jpanfin';
39: public const KHMER = 'khmr';
40: public const KANNADA = 'knda';
41: public const LAO = 'laoo';
42: public const WESTERN = 'latn';
43: public const MALAYALAN = 'mlym';
44: public const MONGOLIAN = 'mong';
45: public const MYANMAR = 'mymr';
46: public const NATIVE = 'native';
47: public const ORIYA = 'orya';
48: public const OSMANYA = 'osma';
49: public const ROMAN = 'roman';
50: public const ROMAN_LOWERCASE = 'romanlow';
51: public const SAURASHTRA = 'saur';
52: public const SUNDANESE = 'sund';
53: public const TRADITIONAL_TAMIL = 'taml';
54: public const TAMIL = 'tamldec';
55: public const TELUGU = 'telu';
56: public const THAI = 'thai';
57: public const TIBETAN = 'tibt';
58: public const TRADITIONAL = 'traditional';
59: public const VAI = 'vaii';
60:
61: public static function validateValue(string &$value): bool
62: {
63: $value = strtolower($value);
64:
65: return parent::validateValue($value);
66: }
67:
68: }
| 0 % | Language\Locale\LocaleVariant.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md'; distributed with this source code
8: */
9:
10: namespace Dogma\Language\Locale;
11:
12: class LocaleVariant extends \Dogma\Enum\PartialStringEnum
13: {
14:
15: public const TRADITIONAL = 'TRADITIONAL';
16:
17: public static function getValueRegexp(): string
18: {
19: return '[A-Z0-9]+';
20: }
21:
22: }
| 0 % | Language\Localization\Translator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language\Localization;
11:
12: interface Translator
13: {
14:
15: public function translate(string $string, ?int $number = null): string;
16:
17: }
| 0 % | Language\Script.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language;
11:
12: class Script extends \Dogma\Enum\StringEnum
13: {
14:
15: public const ADLAM = 'Adlm';
16: public const AFAKA = 'Afak';
17: public const AHOM = 'Ahom';
18: public const ANATOLIAN_HIEROGLYPHS = 'Hluw';
19: public const ARABIC = 'Arab';
20: public const ARABIC_NASTALIQ = 'Aran';
21: public const ARMENIAN = 'Armn';
22: public const AVESTAN = 'Avst';
23: public const BALINESE = 'Bali';
24: public const BAMUM = 'Bamu';
25: public const BASSA_VAH = 'Bass';
26: public const BATAK = 'Batk';
27: public const BENGALI = 'Beng';
28: public const BHAIKSUKI = 'Bhks';
29: public const BLISSYMBOLS = 'Blis';
30: public const BOOK_PAHLAVI = 'Phlv';
31: public const BOPOMOFO = 'Bopo';
32: public const BRAHMI = 'Brah';
33: public const BRAILLE = 'Brai';
34: public const BUGINESE = 'Bugi';
35: public const BUHID = 'Buhd';
36: public const CANADIAN_ABORIGINAL_SYLLABICS = 'Cans';
37: public const CARIAN = 'Cari';
38: public const CAUCASIAN_ALBANIAN = 'Aghb';
39: public const CHAKMA = 'Cakm';
40: public const CHAM = 'Cham';
41: public const CHEROKEE = 'Cher';
42: public const CIRTH = 'Cirt';
43: public const COPTIC = 'Copt';
44: public const CUNEIFORM = 'Xsux';
45: public const CYPRIOT = 'Cprt';
46: public const CYRILLIC = 'Cyrl';
47: public const CYRILLIC_OLD_CHURCH_SLAVONIC = 'Cyrs';
48: public const DESERET = 'Dsrt';
49: public const DEVANAGARI = 'Deva';
50: public const DUPLOYAN_SHORTHAND = 'Dupl';
51: public const EGYPTIAN_DEMOTIC = 'Egyd';
52: public const EGYPTIAN_HIERATIC = 'Egyh';
53: public const EGYPTIAN_HIEROGLYPHS = 'Egyp';
54: public const ELBASAN = 'Elba';
55: public const ETHIOPIC = 'Ethi';
56: public const GEORGIAN = 'Geor';
57: public const GLAGOLITIC = 'Glag';
58: public const GOTHIC = 'Goth';
59: public const GRANTHA = 'Gran';
60: public const GREEK = 'Grek';
61: public const GUJARATI = 'Gujr';
62: public const GURMUKHI = 'Guru';
63: public const HAN = 'Hani';
64: public const HANGUL = 'Hang';
65: public const HANUNOO = 'Hano';
66: public const HAN_SIMPLIFIED = 'Hans';
67: public const HAN_TRADITIONAL = 'Hant';
68: public const HAN_WITH_BOPOMOFO = 'Hanb';
69: public const HATRAN = 'Hatr';
70: public const HEBREW = 'Hebr';
71: public const HIRAGANA = 'Hira';
72: public const IMPERIAL_ARAMAIC = 'Armi';
73: public const INDUS = 'Inds';
74: public const INHERITED_SCRIPT = 'Zinh';
75: public const INSCRIPTIONAL_PAHLAVI = 'Phli';
76: public const INSCRIPTIONAL_PARTHIAN = 'Prti';
77: public const JAMO = 'Jamo';
78: public const JAPANESE = 'Jpan';
79: public const JAPANESE_SYLLABARIES = 'Hrkt';
80: public const JAVANESE = 'Java';
81: public const JURCHEN = 'Jurc';
82: public const KAITHI = 'Kthi';
83: public const KANNADA = 'Knda';
84: public const KATAKANA = 'Kana';
85: public const KAYAH_LI = 'Kali';
86: public const KHAROSHTHI = 'Khar';
87: public const KHITAN_LARGE = 'Kitl';
88: public const KHITAN_SMALL = 'Kits';
89: public const KHMER = 'Khmr';
90: public const KHOJKI = 'Khoj';
91: public const KHUDAWADI = 'Sind';
92: public const KHUTSURI = 'Geok';
93: public const KLINGON = 'Piqd';
94: public const KOREAN = 'Kore';
95: public const KPELLE = 'Kpel';
96: public const LAO = 'Laoo';
97: public const LATIN = 'Latn';
98: public const LATIN_FRAKTUR = 'Latf';
99: public const LATIN_GAELIC = 'Latg';
100: public const LEKE = 'Leke';
101: public const LEPCHA = 'Lepc';
102: public const LIMBU = 'Limb';
103: public const LINEAR_A = 'Lina';
104: public const LINEAR_B = 'Linb';
105: public const LISU = 'Lisu';
106: public const LOMA = 'Loma';
107: public const LYCIAN = 'Lyci';
108: public const LYDIAN = 'Lydi';
109: public const MAHAJANI = 'Mahj';
110: public const MALAYALAM = 'Mlym';
111: public const MANDAIC = 'Mand';
112: public const MANICHAEAN = 'Mani';
113: public const MARCHEN = 'Marc';
114: public const MATHEMATICAL_NOTATION = 'Zmth';
115: public const MAYAN_HIEROGLYPHS = 'Maya';
116: public const MEITEI_MAYEK = 'Mtei';
117: public const MENDE_KIKAKUI = 'Mend';
118: public const MEROITIC_CURSIVE = 'Merc';
119: public const MEROITIC_HIEROGLYPHS = 'Mero';
120: public const MIAO = 'Plrd';
121: public const MODI = 'Modi';
122: public const MONGOLIAN = 'Mong';
123: public const MOON = 'Moon';
124: public const MRO = 'Mroo';
125: public const MULTANI = 'Mult';
126: public const MYANMAR = 'Mymr';
127: public const NABATAEAN = 'Nbat';
128: public const NAKHI_GEBA = 'Nkgb';
129: public const NEWA = 'Newa';
130: public const NEW_TAI_LUE = 'Talu';
131: public const NKO = 'Nkoo';
132: public const NUSHU = 'Nshu';
133: public const OGHAM = 'Ogam';
134: public const OLD_HUNGARIAN = 'Hung';
135: public const OLD_ITALIC = 'Ital';
136: public const OLD_NORTH_ARABIAN = 'Narb';
137: public const OLD_PERMIC = 'Perm';
138: public const OLD_PERSIAN = 'Xpeo';
139: public const OLD_SOUTH_ARABIAN = 'Sarb';
140: public const OL_CHIKI = 'Olck';
141: public const ORIYA = 'Orya';
142: public const ORKHON_RUNIC = 'Orkh';
143: public const OSAGE = 'Osge';
144: public const OSMANYA = 'Osma';
145: public const PAHAWH_HMONG = 'Hmng';
146: public const PALMYRENE = 'Palm';
147: public const PAU_CIN_HAU = 'Pauc';
148: public const PHAGS_PA = 'Phag';
149: public const PHOENICIAN = 'Phnx';
150: public const PSALTER_PAHLAVI = 'Phlp';
151: public const REJANG = 'Rjng';
152: public const RONGORONGO = 'Roro';
153: public const RUNIC = 'Runr';
154: public const SAMARITAN = 'Samr';
155: public const SARATI = 'Sara';
156: public const SAURASHTRA = 'Saur';
157: public const SHARADA = 'Shrd';
158: public const SHAVIAN = 'Shaw';
159: public const SIDDHAM = 'Sidd';
160: public const SIGNWRITING = 'Sgnw';
161: public const SINHALA = 'Sinh';
162: public const SORA_SOMPENG = 'Sora';
163: public const SUNDANESE = 'Sund';
164: public const SYLOTI_NAGRI = 'Sylo';
165: public const SYMBOLS = 'Zsym';
166: public const SYMBOLS_EMOJI = 'Zsye';
167: public const SYRIAC = 'Syrc';
168: public const SYRIAC_EASTERN = 'Syrn';
169: public const SYRIAC_ESTRANGELO = 'Syre';
170: public const SYRIAC_WESTERN = 'Syrj';
171: public const TAGALOG = 'Tglg';
172: public const TAGBANWA = 'Tagb';
173: public const TAI_LE = 'Tale';
174: public const TAI_THAM = 'Lana';
175: public const TAI_VIET = 'Tavt';
176: public const TAKRI = 'Takr';
177: public const TAMIL = 'Taml';
178: public const TANGUT = 'Tang';
179: public const TELUGU = 'Telu';
180: public const TENGWAR = 'Teng';
181: public const THAANA = 'Thaa';
182: public const THAI = 'Thai';
183: public const TIBETAN = 'Tibt';
184: public const TIFINAGH = 'Tfng';
185: public const TIRHUTA = 'Tirh';
186: public const UGARITIC = 'Ugar';
187: public const UNCODED_SCRIPT = 'Zzzz';
188: public const UNDETERMINED_SCRIPT = 'Zyyy';
189: public const UNWRITTEN_DOCUMENTS = 'Zxxx';
190: public const VAI = 'Vaii';
191: public const VISIBLE_SPEECH = 'Visp';
192: public const WARANG_CITI = 'Wara';
193: public const WOLEAI = 'Wole';
194: public const YI = 'Yiii';
195:
196: /** @var string[] */
197: private static $names = [
198: self::ADLAM => 'Adlam',
199: self::AFAKA => 'Afaka',
200: self::AHOM => 'Ahom, Tai Ahom',
201: self::ANATOLIAN_HIEROGLYPHS => 'Anatolian Hieroglyphs (Luwian Hieroglyphs, Hittite Hieroglyphs)',
202: self::ARABIC => 'Arabic',
203: self::ARABIC_NASTALIQ => 'Arabic (Nastaliq variant)',
204: self::ARMENIAN => 'Armenian',
205: self::AVESTAN => 'Avestan',
206: self::BALINESE => 'Balinese',
207: self::BAMUM => 'Bamum',
208: self::BASSA_VAH => 'Bassa Vah',
209: self::BATAK => 'Batak',
210: self::BENGALI => 'Bengali',
211: self::BHAIKSUKI => 'Bhaiksuki',
212: self::BLISSYMBOLS => 'Blissymbols',
213: self::BOOK_PAHLAVI => 'Book Pahlavi',
214: self::BOPOMOFO => 'Bopomofo',
215: self::BRAHMI => 'Brahmi',
216: self::BRAILLE => 'Braille',
217: self::BUGINESE => 'Buginese',
218: self::BUHID => 'Buhid',
219: self::CANADIAN_ABORIGINAL_SYLLABICS => 'Unified Canadian Aboriginal Syllabics',
220: self::CARIAN => 'Carian',
221: self::CAUCASIAN_ALBANIAN => 'Caucasian Albanian',
222: self::CHAKMA => 'Chakma',
223: self::CHAM => 'Cham',
224: self::CHEROKEE => 'Cherokee',
225: self::CIRTH => 'Cirth',
226: self::COPTIC => 'Coptic',
227: self::CUNEIFORM => 'Cuneiform, Sumero-Akkadian',
228: self::CYPRIOT => 'Cypriot',
229: self::CYRILLIC => 'Cyrillic',
230: self::CYRILLIC_OLD_CHURCH_SLAVONIC => 'Cyrillic (Old Church Slavonic variant)',
231: self::DESERET => 'Deseret (Mormon)',
232: self::DEVANAGARI => 'Devanagari (Nagari)',
233: self::DUPLOYAN_SHORTHAND => 'Duployan shorthand, Duployan stenography',
234: self::EGYPTIAN_DEMOTIC => 'Egyptian demotic',
235: self::EGYPTIAN_HIERATIC => 'Egyptian hieratic',
236: self::EGYPTIAN_HIEROGLYPHS => 'Egyptian hieroglyphs',
237: self::ELBASAN => 'Elbasan',
238: self::ETHIOPIC => 'Ethiopic (Geʻez)',
239: self::GEORGIAN => 'Georgian (Mkhedruli)',
240: self::GLAGOLITIC => 'Glagolitic',
241: self::GOTHIC => 'Gothic',
242: self::GRANTHA => 'Grantha',
243: self::GREEK => 'Greek',
244: self::GUJARATI => 'Gujarati',
245: self::GURMUKHI => 'Gurmukhi',
246: self::HAN => 'Han (Hanzi, Kanji, Hanja)',
247: self::HANGUL => 'Hangul (Hangŭl, Hangeul)',
248: self::HANUNOO => 'Hanunoo (Hanunóo)',
249: self::HAN_SIMPLIFIED => 'Han (Simplified variant)',
250: self::HAN_TRADITIONAL => 'Han (Traditional variant)',
251: self::HAN_WITH_BOPOMOFO => 'Han with Bopomofo (alias for Han + Bopomofo)',
252: self::HATRAN => 'Hatran',
253: self::HEBREW => 'Hebrew',
254: self::HIRAGANA => 'Hiragana',
255: self::IMPERIAL_ARAMAIC => 'Imperial Aramaic',
256: self::INDUS => 'Indus (Harappan)',
257: self::INHERITED_SCRIPT => 'Code for inherited script',
258: self::INSCRIPTIONAL_PAHLAVI => 'Inscriptional Pahlavi',
259: self::INSCRIPTIONAL_PARTHIAN => 'Inscriptional Parthian',
260: self::JAMO => 'Jamo (alias for Jamo subset of Hangul)',
261: self::JAPANESE => 'Japanese (alias for Han + Hiragana + Katakana)',
262: self::JAPANESE_SYLLABARIES => 'Japanese syllabaries (alias for Hiragana + Katakana)',
263: self::JAVANESE => 'Javanese',
264: self::JURCHEN => 'Jurchen',
265: self::KAITHI => 'Kaithi',
266: self::KANNADA => 'Kannada',
267: self::KATAKANA => 'Katakana',
268: self::KAYAH_LI => 'Kayah Li',
269: self::KHAROSHTHI => 'Kharoshthi',
270: self::KHITAN_LARGE => 'Khitan large script',
271: self::KHITAN_SMALL => 'Khitan small script',
272: self::KHMER => 'Khmer',
273: self::KHOJKI => 'Khojki',
274: self::KHUDAWADI => 'Khudawadi, Sindhi',
275: self::KHUTSURI => 'Khutsuri (Asomtavruli and Nuskhuri)',
276: self::KLINGON => 'Klingon (KLI pIqaD)',
277: self::KOREAN => 'Korean (alias for Hangul + Han)',
278: self::KPELLE => 'Kpelle',
279: self::LAO => 'Lao',
280: self::LATIN => 'Latin',
281: self::LATIN_FRAKTUR => 'Latin (Fraktur variant)',
282: self::LATIN_GAELIC => 'Latin (Gaelic variant)',
283: self::LEKE => 'Leke',
284: self::LEPCHA => 'Lepcha (Róng)',
285: self::LIMBU => 'Limbu',
286: self::LINEAR_A => 'Linear A',
287: self::LINEAR_B => 'Linear B',
288: self::LISU => 'Lisu (Fraser)',
289: self::LOMA => 'Loma',
290: self::LYCIAN => 'Lycian',
291: self::LYDIAN => 'Lydian',
292: self::MAHAJANI => 'Mahajani',
293: self::MALAYALAM => 'Malayalam',
294: self::MANDAIC => 'Mandaic, Mandaean',
295: self::MANICHAEAN => 'Manichaean',
296: self::MARCHEN => 'Marchen',
297: self::MATHEMATICAL_NOTATION => 'Mathematical notation',
298: self::MAYAN_HIEROGLYPHS => 'Mayan hieroglyphs',
299: self::MEITEI_MAYEK => 'Meitei Mayek (Meithei, Meetei)',
300: self::MENDE_KIKAKUI => 'Mende Kikakui',
301: self::MEROITIC_CURSIVE => 'Meroitic Cursive',
302: self::MEROITIC_HIEROGLYPHS => 'Meroitic Hieroglyphs',
303: self::MIAO => 'Miao (Pollard)',
304: self::MODI => 'Modi, Moḍī',
305: self::MONGOLIAN => 'Mongolian',
306: self::MOON => 'Moon (Moon code, Moon script, Moon type)',
307: self::MRO => 'Mro, Mru',
308: self::MULTANI => 'Multani',
309: self::MYANMAR => 'Myanmar (Burmese)',
310: self::NABATAEAN => 'Nabataean',
311: self::NAKHI_GEBA => 'Nakhi Geba (\'Na-\'Khi ²Ggŏ-¹baw, Naxi Geba)',
312: self::NEWA => 'Newa, Newar, Newari, Nepāla lipi',
313: self::NEW_TAI_LUE => 'New Tai Lue',
314: self::NKO => 'N’Ko',
315: self::NUSHU => 'Nüshu',
316: self::OGHAM => 'Ogham',
317: self::OLD_HUNGARIAN => 'Old Hungarian (Hungarian Runic)',
318: self::OLD_ITALIC => 'Old Italic (Etruscan, Oscan, etc.)',
319: self::OLD_NORTH_ARABIAN => 'Old North Arabian (Ancient North Arabian)',
320: self::OLD_PERMIC => 'Old Permic',
321: self::OLD_PERSIAN => 'Old Persian',
322: self::OLD_SOUTH_ARABIAN => 'Old South Arabian',
323: self::OL_CHIKI => 'Ol Chiki (Ol Cemet’, Ol, Santali)',
324: self::ORIYA => 'Oriya',
325: self::ORKHON_RUNIC => 'Old Turkic, Orkhon Runic',
326: self::OSAGE => 'Osage',
327: self::OSMANYA => 'Osmanya',
328: self::PAHAWH_HMONG => 'Pahawh Hmong',
329: self::PALMYRENE => 'Palmyrene',
330: self::PAU_CIN_HAU => 'Pau Cin Hau',
331: self::PHAGS_PA => 'Phags-pa',
332: self::PHOENICIAN => 'Phoenician',
333: self::PSALTER_PAHLAVI => 'Psalter Pahlavi',
334: self::REJANG => 'Rejang (Redjang, Kaganga)',
335: self::RONGORONGO => 'Rongorongo',
336: self::RUNIC => 'Runic',
337: self::SAMARITAN => 'Samaritan',
338: self::SARATI => 'Sarati',
339: self::SAURASHTRA => 'Saurashtra',
340: self::SHARADA => 'Sharada, Śāradā',
341: self::SHAVIAN => 'Shavian (Shaw)',
342: self::SIDDHAM => 'Siddham, Siddhaṃ, Siddhamātṛkā',
343: self::SIGNWRITING => 'SignWriting',
344: self::SINHALA => 'Sinhala',
345: self::SORA_SOMPENG => 'Sora Sompeng',
346: self::SUNDANESE => 'Sundanese',
347: self::SYLOTI_NAGRI => 'Syloti Nagri',
348: self::SYMBOLS => 'Symbols',
349: self::SYMBOLS_EMOJI => 'Symbols (Emoji variant)',
350: self::SYRIAC => 'Syriac',
351: self::SYRIAC_EASTERN => 'Syriac (Eastern variant)',
352: self::SYRIAC_ESTRANGELO => 'Syriac (Estrangelo variant)',
353: self::SYRIAC_WESTERN => 'Syriac (Western variant)',
354: self::TAGALOG => 'Tagalog (Baybayin, Alibata)',
355: self::TAGBANWA => 'Tagbanwa',
356: self::TAI_LE => 'Tai Le',
357: self::TAI_THAM => 'Tai Tham (Lanna)',
358: self::TAI_VIET => 'Tai Viet',
359: self::TAKRI => 'Takri, Ṭākrī, Ṭāṅkrī',
360: self::TAMIL => 'Tamil',
361: self::TANGUT => 'Tangut',
362: self::TELUGU => 'Telugu',
363: self::TENGWAR => 'Tengwar',
364: self::THAANA => 'Thaana',
365: self::THAI => 'Thai',
366: self::TIBETAN => 'Tibetan',
367: self::TIFINAGH => 'Tifinagh (Berber)',
368: self::TIRHUTA => 'Tirhuta',
369: self::UGARITIC => 'Ugaritic',
370: self::UNCODED_SCRIPT => 'Code for uncoded script',
371: self::UNDETERMINED_SCRIPT => 'Code for undetermined script',
372: self::UNWRITTEN_DOCUMENTS => 'Code for unwritten documents',
373: self::VAI => 'Vai',
374: self::VISIBLE_SPEECH => 'Visible Speech',
375: self::WARANG_CITI => 'Warang Citi (Varang Kshiti)',
376: self::WOLEAI => 'Woleai',
377: self::YI => 'Yi',
378: ];
379:
380: /** @var string[] */
381: private static $idents = [
382: self::ADLAM => 'adlam',
383: self::AFAKA => 'afaka',
384: self::AHOM => 'ahom',
385: self::ANATOLIAN_HIEROGLYPHS => 'anatolian-hieroglyphs',
386: self::ARABIC => 'arabic',
387: self::ARABIC_NASTALIQ => 'arabic-nastaliq',
388: self::ARMENIAN => 'armenian',
389: self::AVESTAN => 'avestan',
390: self::BALINESE => 'balinese',
391: self::BAMUM => 'bamum',
392: self::BASSA_VAH => 'bassa-vah',
393: self::BATAK => 'batak',
394: self::BENGALI => 'bengali',
395: self::BHAIKSUKI => 'bhaiksuki',
396: self::BLISSYMBOLS => 'blissymbols',
397: self::BOOK_PAHLAVI => 'book-pahlavi',
398: self::BOPOMOFO => 'bopomofo',
399: self::BRAHMI => 'brahmi',
400: self::BRAILLE => 'braille',
401: self::BUGINESE => 'buginese',
402: self::BUHID => 'buhid',
403: self::CANADIAN_ABORIGINAL_SYLLABICS => 'canadian-aboriginal-syllabics',
404: self::CARIAN => 'carian',
405: self::CAUCASIAN_ALBANIAN => 'caucasian-albanian',
406: self::CHAKMA => 'chakma',
407: self::CHAM => 'cham',
408: self::CHEROKEE => 'cherokee',
409: self::CIRTH => 'cirth',
410: self::COPTIC => 'coptic',
411: self::CUNEIFORM => 'cuneiform',
412: self::CYPRIOT => 'cypriot',
413: self::CYRILLIC => 'cyrillic',
414: self::CYRILLIC_OLD_CHURCH_SLAVONIC => 'cyrillic-old-church-slavonic',
415: self::DESERET => 'deseret',
416: self::DEVANAGARI => 'devanagari',
417: self::DUPLOYAN_SHORTHAND => 'duployan-shorthand',
418: self::EGYPTIAN_DEMOTIC => 'egyptian-demotic',
419: self::EGYPTIAN_HIERATIC => 'egyptian-hieratic',
420: self::EGYPTIAN_HIEROGLYPHS => 'egyptian-hieroglyphs',
421: self::ELBASAN => 'elbasan',
422: self::ETHIOPIC => 'ethiopic',
423: self::GEORGIAN => 'georgian',
424: self::GLAGOLITIC => 'glagolitic',
425: self::GOTHIC => 'gothic',
426: self::GRANTHA => 'grantha',
427: self::GREEK => 'greek',
428: self::GUJARATI => 'gujarati',
429: self::GURMUKHI => 'gurmukhi',
430: self::HAN => 'han',
431: self::HANGUL => 'hangul',
432: self::HANUNOO => 'hanunoo',
433: self::HAN_SIMPLIFIED => 'han-simplified',
434: self::HAN_TRADITIONAL => 'han-traditional',
435: self::HAN_WITH_BOPOMOFO => 'han-with-bopomofo',
436: self::HATRAN => 'hatran',
437: self::HEBREW => 'hebrew',
438: self::HIRAGANA => 'hiragana',
439: self::IMPERIAL_ARAMAIC => 'imperial-aramaic',
440: self::INDUS => 'indus',
441: self::INHERITED_SCRIPT => 'inherited-script',
442: self::INSCRIPTIONAL_PAHLAVI => 'inscriptional-pahlavi',
443: self::INSCRIPTIONAL_PARTHIAN => 'inscriptional-parthian',
444: self::JAMO => 'jamo',
445: self::JAPANESE => 'japanese',
446: self::JAPANESE_SYLLABARIES => 'japanese-syllabaries',
447: self::JAVANESE => 'javanese',
448: self::JURCHEN => 'jurchen',
449: self::KAITHI => 'kaithi',
450: self::KANNADA => 'kannada',
451: self::KATAKANA => 'katakana',
452: self::KAYAH_LI => 'kayah-li',
453: self::KHAROSHTHI => 'kharoshthi',
454: self::KHITAN_LARGE => 'khitan-large',
455: self::KHITAN_SMALL => 'khitan-small',
456: self::KHMER => 'khmer',
457: self::KHOJKI => 'khojki',
458: self::KHUDAWADI => 'khudawadi',
459: self::KHUTSURI => 'khutsuri',
460: self::KLINGON => 'klingon',
461: self::KOREAN => 'korean',
462: self::KPELLE => 'kpelle',
463: self::LAO => 'lao',
464: self::LATIN => 'latin',
465: self::LATIN_FRAKTUR => 'latin-fraktur',
466: self::LATIN_GAELIC => 'latin-gaelic',
467: self::LEKE => 'leke',
468: self::LEPCHA => 'lepcha',
469: self::LIMBU => 'limbu',
470: self::LINEAR_A => 'linear-a',
471: self::LINEAR_B => 'linear-b',
472: self::LISU => 'lisu',
473: self::LOMA => 'loma',
474: self::LYCIAN => 'lycian',
475: self::LYDIAN => 'lydian',
476: self::MAHAJANI => 'mahajani',
477: self::MALAYALAM => 'malayalam',
478: self::MANDAIC => 'mandaic',
479: self::MANICHAEAN => 'manichaean',
480: self::MARCHEN => 'marchen',
481: self::MATHEMATICAL_NOTATION => 'mathematical-notation',
482: self::MAYAN_HIEROGLYPHS => 'mayan-hieroglyphs',
483: self::MEITEI_MAYEK => 'meitei-mayek',
484: self::MENDE_KIKAKUI => 'mende-kikakui',
485: self::MEROITIC_CURSIVE => 'meroitic-cursive',
486: self::MEROITIC_HIEROGLYPHS => 'meroitic-hieroglyphs',
487: self::MIAO => 'miao',
488: self::MODI => 'modi',
489: self::MONGOLIAN => 'mongolian',
490: self::MOON => 'moon',
491: self::MRO => 'mro',
492: self::MULTANI => 'multani',
493: self::MYANMAR => 'myanmar',
494: self::NABATAEAN => 'nabataean',
495: self::NAKHI_GEBA => 'nakhi-geba',
496: self::NEWA => 'newa',
497: self::NEW_TAI_LUE => 'new-tai-lue',
498: self::NKO => 'nko',
499: self::NUSHU => 'nushu',
500: self::OGHAM => 'ogham',
501: self::OLD_HUNGARIAN => 'old-hungarian',
502: self::OLD_ITALIC => 'old-italic',
503: self::OLD_NORTH_ARABIAN => 'old-north-arabian',
504: self::OLD_PERMIC => 'old-permic',
505: self::OLD_PERSIAN => 'old-persian',
506: self::OLD_SOUTH_ARABIAN => 'old-south-arabian',
507: self::OL_CHIKI => 'ol-chiki',
508: self::ORIYA => 'oriya',
509: self::ORKHON_RUNIC => 'orkhon-runic',
510: self::OSAGE => 'osage',
511: self::OSMANYA => 'osmanya',
512: self::PAHAWH_HMONG => 'pahawh-hmong',
513: self::PALMYRENE => 'palmyrene',
514: self::PAU_CIN_HAU => 'pau-cin-hau',
515: self::PHAGS_PA => 'phags-pa',
516: self::PHOENICIAN => 'phoenician',
517: self::PSALTER_PAHLAVI => 'psalter-pahlavi',
518: self::REJANG => 'rejang',
519: self::RONGORONGO => 'rongorongo',
520: self::RUNIC => 'runic',
521: self::SAMARITAN => 'samaritan',
522: self::SARATI => 'sarati',
523: self::SAURASHTRA => 'saurashtra',
524: self::SHARADA => 'sharada',
525: self::SHAVIAN => 'shavian',
526: self::SIDDHAM => 'siddham',
527: self::SIGNWRITING => 'signwriting',
528: self::SINHALA => 'sinhala',
529: self::SORA_SOMPENG => 'sora-sompeng',
530: self::SUNDANESE => 'sundanese',
531: self::SYLOTI_NAGRI => 'syloti-nagri',
532: self::SYMBOLS => 'symbols',
533: self::SYMBOLS_EMOJI => 'symbols-emoji',
534: self::SYRIAC => 'syriac',
535: self::SYRIAC_EASTERN => 'syriac-eastern',
536: self::SYRIAC_ESTRANGELO => 'syriac-estrangelo',
537: self::SYRIAC_WESTERN => 'syriac-western',
538: self::TAGALOG => 'tagalog',
539: self::TAGBANWA => 'tagbanwa',
540: self::TAI_LE => 'tai-le',
541: self::TAI_THAM => 'tai-tham',
542: self::TAI_VIET => 'tai-viet',
543: self::TAKRI => 'takri',
544: self::TAMIL => 'tamil',
545: self::TANGUT => 'tangut',
546: self::TELUGU => 'telugu',
547: self::TENGWAR => 'tengwar',
548: self::THAANA => 'thaana',
549: self::THAI => 'thai',
550: self::TIBETAN => 'tibetan',
551: self::TIFINAGH => 'tifinagh',
552: self::TIRHUTA => 'tirhuta',
553: self::UGARITIC => 'ugaritic',
554: self::UNCODED_SCRIPT => 'uncoded-script',
555: self::UNDETERMINED_SCRIPT => 'undetermined-script',
556: self::UNWRITTEN_DOCUMENTS => 'unwritten-documents',
557: self::VAI => 'vai',
558: self::VISIBLE_SPEECH => 'visible-speech',
559: self::WARANG_CITI => 'warang-citi',
560: self::WOLEAI => 'woleai',
561: self::YI => 'yi',
562: ];
563:
564: public function getName(): string
565: {
566: return self::$names[$this->getValue()];
567: }
568:
569: public function getIdent(): string
570: {
571: return self::$idents[$this->getValue()];
572: }
573:
574: public static function getByIdent(string $ident): self
575: {
576: return self::get(array_search($ident, self::$idents));
577: }
578:
579: public static function validateValue(string &$value): bool
580: {
581: $value = ucfirst(strtolower($value));
582:
583: return parent::validateValue($value);
584: }
585:
586: }
| 50 % | Language\Transliterator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language;
11:
12: /**
13: * @see http://userguide.icu-project.org/transforms/general
14: */
15: class Transliterator extends \Transliterator
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: // general rules
20: public const DECOMPOSE = 'Any-NFD';
21: public const COMPOSE = 'Any-NFC';
22: public const COMPATIBILITY_DECOMPOSE = 'Any-NFKD';
23: public const COMPATIBILITY_COMPOSE = 'Any-NFKC';
24:
25: public const NULL = 'Any-Null';
26: public const REMOVE = 'Any-Remove';
27:
28: public const LOWER_CASE = 'Any-Lower';
29: public const UPPER_CASE = 'Any-Upper';
30: public const TITLE_CASE = 'Any-Title';
31:
32: public const ENCODE_NAMES = 'Any-Name';
33: public const DECODE_NAMES = 'Name-Any';
34:
35: public const HEX_C = 'Any-Hex/C';
36: public const UNHEX_C = 'Hex-Any/C';
37: public const HEX_JAVA = 'Any-Hex/Java';
38: public const UNHEX_JAVA = 'Hex-Any/Java';
39: public const HEX_PERL = 'Any-Hex/Perl';
40: public const UNHEX_PERL = 'Hex-Any/Perl';
41: public const HEX_XML = 'Any-Hex/XML';
42: public const UNHEX_XML = 'Hex-Any/XML';
43:
44: public const FIX_ACCENTS = 'Any-Accents';
45: public const ASCII_ACCENTS = 'Accents-Any';
46:
47: public const FIX_TYPOGRAPHY = 'Any-Publishing';
48: public const ASCII_TYPOGRAPHY = 'Publishing-Any';
49:
50: public const TO_ASCII = 'Latin-ASCII';
51:
52: // script rules
53: public const TO_ARABIC = 'Any-Arabic';
54: public const TO_BENGALI = 'Any-Bengali';
55: public const TO_CYRILLIC = 'Any-Cyrillic';
56: public const TO_DEVANAGARI = 'Any-Devanagari';
57: public const TO_GREEK = 'Any-Greek';
58: public const TO_GREEK_UNGEGN = 'Any-Greek/UNGEGN';
59: public const TO_GUJARATI = 'Any-Gujarati';
60: public const TO_GURMUKHI = 'Any-Gurmukhi';
61: public const TO_HAN = 'Any-Han';
62: public const TO_HANGUL = 'Any-Hangul';
63: public const TO_HEBREW = 'Any-Hebrew';
64: public const TO_HIRAGANA = 'Any-Hiragana';
65: public const TO_KANNADA = 'Any-Kannada';
66: public const TO_KATAKANA = 'Any-Katakana';
67: public const TO_LATIN = 'Any-Latin';
68: public const TO_MALAYALAM = 'Any-Malayalam';
69: public const TO_ORIYA = 'Any-Oriya';
70: public const TO_TAMIL = 'Any-Tamil';
71: public const TO_TELUGU = 'Any-Telugu';
72: public const TO_THAI = 'Any-Thai'; // may not be available
73:
74: public const ARABIC_TO_LATIN = 'Arabic-Latin';
75: public const BENGALI_TO_DEVANAGARI = 'Bengali-Devanagari';
76: public const BENGALI_TO_GUJARATI = 'Bengali-Gujarati';
77: public const BENGALI_TO_GURMUKHI = 'Bengali-Gurmukhi';
78: public const BENGALI_TO_KANNADA = 'Bengali-Kannada';
79: public const BENGALI_TO_LATIN = 'Bengali-Latin';
80: public const BENGALI_TO_MALAYALAM = 'Bengali-Malayalam';
81: public const BENGALI_TO_ORIYA = 'Bengali-Oriya';
82: public const BENGALI_TO_TAMIL = 'Bengali-Tamil';
83: public const BENGALI_TO_TELUGU = 'Bengali-Telugu';
84: public const CYRILLIC_TO_LATIN = 'Cyrillic-Latin';
85: public const DEVANAGARI_TO_BENGALI = 'Devanagari-Bengali';
86: public const DEVANAGARI_TO_GUJARATI = 'Devanagari-Gujarati';
87: public const DEVANAGARI_TO_GURMUKHI = 'Devanagari-Gurmukhi';
88: public const DEVANAGARI_TO_KANNADA = 'Devanagari-Kannada';
89: public const DEVANAGARI_TO_LATIN = 'Devanagari-Latin';
90: public const DEVANAGARI_TO_MALAYALAM = 'Devanagari-Malayalam';
91: public const DEVANAGARI_TO_ORIYA = 'Devanagari-Oriya';
92: public const DEVANAGARI_TO_TAMIL = 'Devanagari-Tamil';
93: public const DEVANAGARI_TO_TELUGU = 'Devanagari-Telugu';
94: public const GREEK_TO_LATIN = 'Greek-Latin';
95: public const GREEK_TO_LATIN_UNGEGN = 'Greek-Latin/UNGEGN';
96: public const GUJARATI_TO_BENGALI = 'Gujarati-Bengali';
97: public const GUJARATI_TO_DEVANAGARI = 'Gujarati-Devanagari';
98: public const GUJARATI_TO_GURMUKHI = 'Gujarati-Gurmukhi';
99: public const GUJARATI_TO_KANNADA = 'Gujarati-Kannada';
100: public const GUJARATI_TO_LATIN = 'Gujarati-Latin';
101: public const GUJARATI_TO_MALAYALAM = 'Gujarati-Malayalam';
102: public const GUJARATI_TO_ORIYA = 'Gujarati-Oriya';
103: public const GUJARATI_TO_TAMIL = 'Gujarati-Tamil';
104: public const GUJARATI_TO_TELUGU = 'Gujarati-Telugu';
105: public const GURMUKHI_TO_BENGALI = 'Gurmukhi-Bengali';
106: public const GURMUKHI_TO_DEVANAGARI = 'Gurmukhi-Devanagari';
107: public const GURMUKHI_TO_GUJARATI = 'Gurmukhi-Gujarati';
108: public const GURMUKHI_TO_KANNADA = 'Gurmukhi-Kannada';
109: public const GURMUKHI_TO_LATIN = 'Gurmukhi-Latin';
110: public const GURMUKHI_TO_MALAYALAM = 'Gurmukhi-Malayalam';
111: public const GURMUKHI_TO_ORIYA = 'Gurmukhi-Oriya';
112: public const GURMUKHI_TO_TAMIL = 'Gurmukhi-Tamil';
113: public const GURMUKHI_TO_TELUGU = 'Gurmukhi-Telugu';
114: public const HAN_TO_LATIN = 'Han-Latin';
115: public const HANGUL_TO_LATIN = 'Hangul-Latin';
116: public const HEBREW_TO_LATIN = 'Hebrew-Latin';
117: public const HIRAGANA_TO_KATAKANA = 'Hiragana-Katakana';
118: public const HIRAGANA_TO_LATIN = 'Hiragana-Latin';
119: public const JAMO_TO_LATIN = 'Jamo-Latin';
120: public const KANNADA_TO_BENGALI = 'Kannada-Bengali';
121: public const KANNADA_TO_DEVANAGARI = 'Kannada-Devanagari';
122: public const KANNADA_TO_GUJARATI = 'Kannada-Gujarati';
123: public const KANNADA_TO_GURMUKHI = 'Kannada-Gurmukhi';
124: public const KANNADA_TO_LATIN = 'Kannada-Latin';
125: public const KANNADA_TO_MALAYALAM = 'Kannada-Malayalam';
126: public const KANNADA_TO_ORIYA = 'Kannada-Oriya';
127: public const KANNADA_TO_TAMIL = 'Kannada-Tamil';
128: public const KANNADA_TO_TELUGU = 'Kannada-Telugu';
129: public const KATAKANA_TO_HIRAGANA = 'Katakana-Hiragana';
130: public const KATAKANA_TO_LATIN = 'Katakana-Latin';
131: public const LATIN_TO_ARABIC = 'Latin-Arabic';
132: public const LATIN_TO_BENGALI = 'Latin-Bengali';
133: public const LATIN_TO_CYRILLIC = 'Latin-Cyrillic';
134: public const LATIN_TO_DEVANAGARI = 'Latin-Devanagari';
135: public const LATIN_TO_GREEK = 'Latin-Greek';
136: public const LATIN_TO_GREEK_UNGEON = 'Latin-Greek/UNGEGN';
137: public const LATIN_TO_GUJARATI = 'Latin-Gujarati';
138: public const LATIN_TO_GURMUKHI = 'Latin-Gurmukhi';
139: public const LATIN_TO_HAN = 'Latin-Han';
140: public const LATIN_TO_HANGUL = 'Latin-Hangul';
141: public const LATIN_TO_HEBREW = 'Latin-Hebrew';
142: public const LATIN_TO_HIRAGANA = 'Latin-Hiragana';
143: public const LATIN_TO_JAMO = 'Latin-Jamo';
144: public const LATIN_TO_KANNADA = 'Latin-Kannada';
145: public const LATIN_TO_KATAKANA = 'Latin-Katakana';
146: public const LATIN_TO_MALAYALAM = 'Latin-Malayalam';
147: public const LATIN_TO_ORIYA = 'Latin-Oriya';
148: public const LATIN_TO_TAMIL = 'Latin-Tamil';
149: public const LATIN_TO_TELUGU = 'Latin-Telugu';
150: public const LATIN_TO_THAI = 'Latin-Thai'; // may not be available
151: public const MALAYALAM_TO_BENGALI = 'Malayalam-Bengali';
152: public const MALAYALAM_TO_DEVANAGARI = 'Malayalam-Devanagari';
153: public const MALAYALAM_TO_GUJARATI = 'Malayalam-Gujarati';
154: public const MALAYALAM_TO_GURMUKHI = 'Malayalam-Gurmukhi';
155: public const MALAYALAM_TO_KANNADA = 'Malayalam-Kannada';
156: public const MALAYALAM_TO_LATIN = 'Malayalam-Latin';
157: public const MALAYALAM_TO_ORIYA = 'Malayalam-Oriya';
158: public const MALAYALAM_TO_TAMIL = 'Malayalam-Tamil';
159: public const MALAYALAM_TO_TELUGU = 'Malayalam-Telugu';
160: public const ORIYA_TO_BENGALI = 'Oriya-Bengali';
161: public const ORIYA_TO_DEVANAGARI = 'Oriya-Devanagari';
162: public const ORIYA_TO_GUJARATI = 'Oriya-Gujarati';
163: public const ORIYA_TO_GURMUKHI = 'Oriya-Gurmukhi';
164: public const ORIYA_TO_KANNADA = 'Oriya-Kannada';
165: public const ORIYA_TO_LATIN = 'Oriya-Latin';
166: public const ORIYA_TO_MALAYALAM = 'Oriya-Malayalam';
167: public const ORIYA_TO_TAMIL = 'Oriya-Tamil';
168: public const ORIYA_TO_TELUGU = 'Oriya-Telugu';
169: public const TAMIL_TO_BENGALI = 'Tamil-Bengali';
170: public const TAMIL_TO_DEVANAGARI = 'Tamil-Devanagari';
171: public const TAMIL_TO_GUJARATI = 'Tamil-Gujarati';
172: public const TAMIL_TO_GURMUKHI = 'Tamil-Gurmukhi';
173: public const TAMIL_TO_KANNADA = 'Tamil-Kannada';
174: public const TAMIL_TO_LATIN = 'Tamil-Latin';
175: public const TAMIL_TO_MALAYALAM = 'Tamil-Malayalam';
176: public const TAMIL_TO_ORIYA = 'Tamil-Oriya';
177: public const TAMIL_TO_TELUGU = 'Tamil-Telugu';
178: public const TELUGU_TO_BENGALI = 'Telugu-Bengali';
179: public const TELUGU_TO_DEVANAGARI = 'Telugu-Devanagari';
180: public const TELUGU_TO_GUJARATI = 'Telugu-Gujarati';
181: public const TELUGU_TO_GURMUKHI = 'Telugu-Gurmukhi';
182: public const TELUGU_TO_KANNADA = 'Telugu-Kannada';
183: public const TELUGU_TO_LATIN = 'Telugu-Latin';
184: public const TELUGU_TO_MALAYALAM = 'Telugu-Malayalam';
185: public const TELUGU_TO_ORIYA = 'Telugu-Oriya';
186: public const TELUGU_TO_TAMIL = 'Telugu-Tamil';
187: public const THAI_TO_LATIN = 'Thai-Latin'; // may not be available
188:
189: public const FULLWIDTH_TO_HALFWIDTH = 'Fullwidth-Halfwidth';
190: public const HALFWIDTH_TO_FULLWIDTH = 'Halfwidth-Fullwidth';
191:
192: /** @var \Transliterator[] */
193: private static $instances = [];
194:
195: /**
196: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
197: * @param string $id
198: * @param int|null $direction
199: * @return \Transliterator
200: */
201: public static function create($id, $direction = null): \Transliterator
202: {
203: if (isset(self::$instances[$id])) {
204: return self::$instances[$id];
205: }
206:
207: $transliterator = parent::create($id, $direction);
208: if ($transliterator === null) {
209: throw new \Dogma\Language\TransliteratorException(intl_get_error_message());
210: }
211: self::$instances[$id] = $transliterator;
212:
213: return $transliterator;
214: }
215:
216: /**
217: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
218: * @param string $rules
219: * @param int|null $direction
220: * @return \Transliterator
221: */
222: public static function createFromRules($rules, $direction = null): \Transliterator
223: {
224: $transliterator = parent::createFromRules($rules, $direction);
225: if ($transliterator === null) {
226: throw new \Dogma\Language\TransliteratorException(intl_get_error_message());
227: }
228:
229: return $transliterator;
230: }
231:
232: /**
233: * Accepts array of: rule id, tuple of rule id and filter or tuple of rule id and array of filters.
234: * Example of transliterator for removing diacritics:
235: * ```
236: * Transliterator::createFromIds([
237: * Transliterator::DECOMPOSE,
238: * [Transliterator::REMOVE, CharacterCategory::NONSPACING_MARK],
239: * Transliterator::COMPOSE,
240: * ]
241: * ```
242: *
243: * @param string[]|string[][] $rules
244: * @param int|null $direction
245: * @return \Transliterator
246: */
247: public static function createFromIds(array $rules, ?int $direction = null): ?\Transliterator
248: {
249: $rules = array_map(function ($rule): string {
250: return is_array($rule)
251: ? (is_array($rule[1])
252: ? '[[:' . implode(':][:', $rule[1]) . ':]] ' . $rule[0]
253: : '[:' . $rule[1] . ':] ' . $rule[0])
254: : $rule;
255: }, $rules);
256:
257: return self::create(implode(';', $rules), $direction);
258: }
259:
260: public static function createFromScripts(Script $fromScript, Script $toScript): ?\Transliterator
261: {
262: $from = explode(' ', $fromScript->getName())[0];
263: $to = explode(' ', $toScript->getName())[0];
264:
265: return self::create(sprintf('%s-%s', $from, $to));
266: }
267:
268: }
| 67 % | Language\UnicodeCharacterCategory.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Language;
11:
12: class UnicodeCharacterCategory extends \Dogma\Enum\StringEnum
13: {
14:
15: public const OTHER = 'C';
16: public const CONTROL = 'Cc';
17: public const FORMAT = 'Cf';
18: public const PRIVATE_USE = 'Co';
19: public const SURROGATE = 'Cs';
20:
21: public const LETTER = 'L';
22: public const LOWERCASE_LETTER = 'Ll';
23: public const MODIFIER_LETTER = 'Lm';
24: public const OTHER_LETTER = 'Lo';
25: public const TITLE_CASE_LETTER = 'Lt';
26: public const UPPER_CASE_LETTER = 'Lu';
27:
28: public const MARK = 'M';
29: public const SPACING_MARK = 'Mc';
30: public const ENCLOSING_MARK = 'Me';
31: public const NONSPACING_MARK = 'Mn';
32:
33: public const NUMBER = 'N';
34: public const DECIMAL_NUMBER = 'Nd';
35: public const LETTER_NUMBER = 'Nl';
36: public const OTHER_NUMBER = 'No';
37:
38: public const PUNCTUATION = 'P';
39: public const CONNECTOR_PUNCTUATION = 'Pc';
40: public const DASH_PUNCTUATION = 'Pd';
41: public const CLOSE_PUNCTUATION = 'Pe';
42: public const FINAL_PUNCTUATION = 'Pf';
43: public const INITIAL_PUNCTUATION = 'Pi';
44: public const OTHER_PUNCTUATION = 'Po';
45: public const OPEN_PUNCTUATION = 'Ps';
46:
47: public const SYMBOL = 'S';
48: public const CURRENCY_SYMBOL = 'Sc';
49: public const MODIFIER_SYMBOL = 'Sk';
50: public const MATH_SYMBOL = 'Sm';
51: public const OTHER_SYMBOL = 'So';
52:
53: public const SEPARATOR = 'Z';
54: public const LINE_SEPARATOR = 'Zl';
55: public const PARAGRAPH_SEPARATOR = 'Zp';
56: public const SPACE_SEPARATOR = 'Zs';
57:
58: /** @var string[] */
59: private static $names = [
60: self::OTHER => 'Other',
61: self::CONTROL => 'Control',
62: self::FORMAT => 'Format',
63: self::PRIVATE_USE => 'Private Use',
64: self::SURROGATE => 'Surrogate',
65: self::LETTER => 'Letter',
66: self::LOWERCASE_LETTER => 'Lowercase Letter',
67: self::MODIFIER_LETTER => 'Modifier Letter',
68: self::OTHER_LETTER => 'Other Letter',
69: self::TITLE_CASE_LETTER => 'Titlecase Letter',
70: self::UPPER_CASE_LETTER => 'Uppercase Letter',
71: self::MARK => 'Mark',
72: self::SPACING_MARK => 'Spacing Mark',
73: self::ENCLOSING_MARK => 'Enclosing Mark',
74: self::NONSPACING_MARK => 'Nonspacing Mark',
75: self::NUMBER => 'Number',
76: self::DECIMAL_NUMBER => 'Decimal Number',
77: self::LETTER_NUMBER => 'Letter Number',
78: self::OTHER_NUMBER => 'Other Number',
79: self::PUNCTUATION => 'Punctuation',
80: self::CONNECTOR_PUNCTUATION => 'Connector Punctuation',
81: self::DASH_PUNCTUATION => 'Dash Punctuation',
82: self::CLOSE_PUNCTUATION => 'Close Punctuation',
83: self::FINAL_PUNCTUATION => 'Final Punctuation',
84: self::INITIAL_PUNCTUATION => 'Initial Punctuation',
85: self::OTHER_PUNCTUATION => 'Other Punctuation',
86: self::OPEN_PUNCTUATION => 'Open Punctuation',
87: self::SYMBOL => 'Symbol',
88: self::CURRENCY_SYMBOL => 'Currency Symbol',
89: self::MODIFIER_SYMBOL => 'Modifier Symbol',
90: self::MATH_SYMBOL => 'Math Symbol',
91: self::OTHER_SYMBOL => 'Other Symbol',
92: self::SEPARATOR => 'Separator',
93: self::LINE_SEPARATOR => 'Line Separator',
94: self::PARAGRAPH_SEPARATOR => 'Paragraph Separator',
95: self::SPACE_SEPARATOR => 'Space Separator',
96: ];
97:
98: public function getName(): string
99: {
100: return self::$names[$this->getValue()];
101: }
102:
103: }
| 0 % | loader.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: require_once __DIR__ . '/common/mixins/StrictBehaviorMixin.php';
11: require_once __DIR__ . '/common/DogmaLoader.php';
12:
13: \Dogma\DogmaLoader::getInstance()->register();
| 0 % | Mapping\ConfigurationMappingBuilder.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: use Dogma\Mapping\MetaData\TypeMetaDataContainer;
13: use Dogma\Mapping\Naming\NamingStrategy;
14: use Dogma\Type;
15:
16: class ConfigurationMappingBuilder extends \Dogma\Mapping\ConventionMappingBuilder implements \Dogma\Mapping\MappingBuilder
17: {
18: use \Dogma\StrictBehaviorMixin;
19:
20: /** @var mixed[] */
21: private $configuration;
22:
23: /** @var \Dogma\Mapping\MetaData\TypeMetaDataContainer */
24: private $typeMetaData;
25:
26: /** @var \Dogma\Mapping\Naming\NamingStrategy|null */
27: private $fieldNamingStrategy;
28:
29: /**
30: * @param mixed[] $configuration
31: * @param \Dogma\Mapping\MetaData\TypeMetaDataContainer $typeMetaDataContainer
32: * @param \Dogma\Mapping\Naming\NamingStrategy|null $fieldNamingStrategy
33: */
34: public function __construct(
35: array $configuration,
36: TypeMetaDataContainer $typeMetaDataContainer,
37: ?NamingStrategy $fieldNamingStrategy = null
38: ) {
39: parent::__construct($typeMetaDataContainer, $fieldNamingStrategy);
40:
41: $this->configuration = $configuration;
42: $this->typeMetaData = $typeMetaDataContainer;
43: $this->fieldNamingStrategy = $fieldNamingStrategy;
44: }
45:
46: public function buildMapping(Type $type): Mapping
47: {
48: $configuration = $this->getConfiguration($type);
49: if (!$configuration) {
50: return parent::buildMapping($type);
51: }
52:
53: $steps = [];
54:
55: ///
56:
57: return new Mapping($type, $steps);
58: }
59:
60: /**
61: * @param \Dogma\Type $type
62: * @return mixed[]
63: */
64: private function getConfiguration(Type $type): array
65: {
66: ///
67:
68: return [];
69: }
70:
71: }
| 100 % | Mapping\ConventionMappingBuilder.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: use Dogma\Mapping\MetaData\TypeMetaDataContainer;
13: use Dogma\Mapping\Naming\NamingStrategy;
14: use Dogma\Mapping\Naming\ShortFieldNamingStrategy;
15: use Dogma\Mapping\Type\Handler;
16: use Dogma\Type;
17:
18: class ConventionMappingBuilder implements \Dogma\Mapping\MappingBuilder
19: {
20: use \Dogma\StrictBehaviorMixin;
21:
22: /** @var \Dogma\Mapping\MetaData\TypeMetaDataContainer */
23: private $typeMetaData;
24:
25: /** @var \Dogma\Mapping\Naming\NamingStrategy|null */
26: private $fieldNamingStrategy;
27:
28: /** @var string */
29: private $fieldSeparator;
30:
31: public function __construct(
32: TypeMetaDataContainer $typeMetaDataContainer,
33: ?NamingStrategy $fieldNamingStrategy = null,
34: string $fieldSeparator = '.'
35: )
36: {
37: $this->typeMetaData = $typeMetaDataContainer;
38: $this->fieldNamingStrategy = $fieldNamingStrategy ?: new ShortFieldNamingStrategy();
39: $this->fieldSeparator = $fieldSeparator;
40: }
41:
42: public function buildMapping(Type $type): Mapping
43: {
44: $steps = [];
45: $this->buildStep($type, '', Handler::SINGLE_PARAMETER, $steps);
46:
47: return new Mapping($type, $steps);
48: }
49:
50: private function buildStep(Type $type, string $path, string $destinationKey, array &$steps): void
51: {
52: $typeMetaData = $this->typeMetaData->getType($type);
53:
54: $fields = $typeMetaData->getFields();
55: $fieldPath = rtrim($path . $this->fieldSeparator . $type->getName());
56: $handlerKeys = [];
57: foreach ($fields as $fieldHandlerKey => $fieldType) {
58: $fieldDestinationKey = $destinationKey
59: ? ($fieldHandlerKey ? $destinationKey . $this->fieldSeparator . $fieldHandlerKey : $destinationKey)
60: : $fieldHandlerKey;
61: if ($fieldType->is(Type::MIXED)) {
62: $fieldSourceKey = $this->fieldNamingStrategy->translateName($fieldDestinationKey, $fieldPath, $this->fieldSeparator);
63: } else {
64: $fieldSourceKey = $fieldDestinationKey;
65: $this->buildStep($fieldType, $fieldPath, $fieldDestinationKey, $steps);
66: }
67: $handlerKeys[$fieldSourceKey] = $fieldHandlerKey;
68: }
69: $step = new MappingStep($type, $typeMetaData->getHandler(), $handlerKeys, $destinationKey);
70:
71: $steps[] = $step;
72: }
73:
74: }
| 100 % | Mapping\DynamicMappingContainer.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: use Dogma\Type;
13:
14: class DynamicMappingContainer implements \Dogma\Mapping\MappingContainer
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var \Dogma\Mapping\MappingBuilder */
19: private $mappingBuilder;
20:
21: /** @var \Dogma\Mapping\Mapping[] (string $typeId => $mapping) */
22: private $mappings = [];
23:
24: public function __construct(MappingBuilder $mappingBuilder)
25: {
26: $this->mappingBuilder = $mappingBuilder;
27: }
28:
29: public function getMapping(Type $type): Mapping
30: {
31: $typeId = $type->getId();
32: if (!isset($this->mappings[$typeId])) {
33: $this->mappings[$typeId] = $this->mappingBuilder->buildMapping($type);
34: }
35: return $this->mappings[$typeId];
36: }
37:
38: }
| 100 % | Mapping\exceptions\Exception.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: interface Exception
13: {
14:
15: }
| 0 % | Mapping\exceptions\MappingNotFoundException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: use Dogma\Type;
13:
14: class MappingNotFoundException extends \Dogma\Exception implements \Dogma\Mapping\Exception
15: {
16:
17: /** @var \Dogma\Type */
18: private $type;
19:
20: public function __construct(Type $size, ?\Throwable $previous = null)
21: {
22: parent::__construct(sprintf('Mapping for type %s was not found.', $size->getId()), $previous);
23: $this->type = $size;
24: }
25:
26: /**
27: * @return \Dogma\Type
28: */
29: public function getType(): Type
30: {
31: return $this->type;
32: }
33:
34: }
| 67 % | Mapping\Mapper.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: use Dogma\Type;
13:
14: class Mapper
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var \Dogma\Mapping\MappingContainer */
19: private $mappings;
20:
21: public function __construct(MappingContainer $mappings)
22: {
23: $this->mappings = $mappings;
24: }
25:
26: /**
27: * @param \Dogma\Type $type
28: * @param mixed[] $data
29: * @return mixed
30: */
31: public function map(Type $type, array $data)
32: {
33: return $this->mappings->getMapping($type)->mapForward($data, $this);
34: }
35:
36: /**
37: * @param \Dogma\Type $type
38: * @param mixed $data
39: * @return mixed[]
40: */
41: public function reverseMap(Type $type, $data): array
42: {
43: return $this->mappings->getMapping($type)->mapBack($data, $this);
44: }
45:
46: public function mapMany(Type $type, iterable $data): \Traversable
47: {
48: $iterator = new MappingIterator($data, $type->getItemType(), $this);
49:
50: /** @var \Traversable $result */
51: $result = $type->getInstance($iterator);
52:
53: return $result;
54: }
55:
56: public function reverseMapMany(Type $type, iterable $data): MappingIterator
57: {
58: return new MappingIterator($data, $type->getItemType(), $this, true);
59: }
60:
61: }
| 100 % | Mapping\Mapping.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: use Dogma\Mapping\Type\Handler;
13: use Dogma\ReverseArrayIterator;
14: use Dogma\Type;
15:
16: class Mapping
17: {
18: use \Dogma\StrictBehaviorMixin;
19:
20: /** @var \Dogma\Type */
21: private $type;
22:
23: /** @var \Dogma\Mapping\MappingStep[] */
24: private $steps = [];
25:
26: /** @var \Dogma\Mapping\MappingStep[]|\Dogma\ReverseArrayIterator */
27: private $reverseSteps;
28:
29: /**
30: * @param \Dogma\Type $type
31: * @param mixed[] $steps
32: */
33: public function __construct(Type $type, array $steps)
34: {
35: $this->type = $type;
36: $this->steps = $steps;
37:
38: $this->reverseSteps = new ReverseArrayIterator($steps);
39: }
40:
41: /**
42: * @return \Dogma\Mapping\MappingStep[]
43: */
44: public function getSteps(): array
45: {
46: return $this->steps;
47: }
48:
49: /**
50: * @param mixed[] $data
51: * @param \Dogma\Mapping\Mapper $mapper
52: * @return mixed
53: */
54: public function mapForward(array $data, Mapper $mapper)
55: {
56: foreach ($this->steps as $step) {
57: $step->stepForward($data, $mapper);
58: }
59: return $data[Handler::SINGLE_PARAMETER];
60: }
61:
62: /**
63: * @param mixed $instance
64: * @param \Dogma\Mapping\Mapper $mapper
65: * @return mixed[]
66: */
67: public function mapBack($instance, Mapper $mapper): array
68: {
69: $data = [Handler::SINGLE_PARAMETER => $instance];
70: foreach ($this->reverseSteps as $step) {
71: $step->stepBack($data, $mapper);
72: }
73: return $data;
74: }
75:
76: }
| 100 % | Mapping\MappingBuilder.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: use Dogma\Type;
13:
14: interface MappingBuilder
15: {
16:
17: public function buildMapping(Type $type): Mapping;
18:
19: }
| 100 % | Mapping\MappingContainer.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: use Dogma\Type;
13:
14: interface MappingContainer
15: {
16:
17: public function getMapping(Type $type): Mapping;
18:
19: }
| 0 % | Mapping\MappingIterator.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: use Dogma\ArrayIterator;
13: use Dogma\Type;
14:
15: class MappingIterator implements \Iterator
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var \Iterator */
20: private $source;
21:
22: /** @var \Dogma\Type */
23: private $type;
24:
25: /** @var \Dogma\Mapping\Mapper */
26: private $mapper;
27:
28: /** @var bool */
29: private $reverse;
30:
31: /** @var int */
32: private $key = 0;
33:
34: public function __construct(iterable $source, Type $type, Mapper $mapper, bool $reverse = false)
35: {
36: if (is_array($source)) {
37: $source = new ArrayIterator($source);
38: } elseif ($source instanceof \IteratorAggregate) {
39: $source = $source->getIterator();
40: }
41:
42: $this->source = $source;
43: $this->type = $type;
44: $this->mapper = $mapper;
45: $this->reverse = $reverse;
46: }
47:
48: /**
49: * @throws \Exception
50: */
51: public function rewind(): void
52: {
53: $this->source->rewind();
54: $this->key = 0;
55: }
56:
57: public function next(): void
58: {
59: $this->key++;
60: $this->source->next();
61: }
62:
63: public function valid(): bool
64: {
65: return $this->source->valid();
66: }
67:
68: /**
69: * @return mixed|null
70: */
71: public function current()
72: {
73: if ($this->reverse) {
74: return $this->mapper->reverseMap($this->type, $this->source->current());
75: } else {
76: return $this->mapper->map($this->type, $this->source->current());
77: }
78: }
79:
80: public function key(): int
81: {
82: return $this->key;
83: }
84:
85: }
| 100 % | Mapping\MappingStep.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: use Dogma\Mapping\Type\Handler;
13: use Dogma\Type;
14:
15: class MappingStep
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var \Dogma\Type */
20: private $type;
21:
22: /** @var \Dogma\Mapping\Type\Handler */
23: private $handler;
24:
25: /** @var string[] */
26: private $handlerKeys;
27:
28: /** @var string[] */
29: private $sourceKeys;
30:
31: /** @var string */
32: private $destinationKey;
33:
34: /**
35: * @param \Dogma\Type $type
36: * @param \Dogma\Mapping\Type\Handler $handler
37: * @param string[] $handlerKeys ($sourceKey => $handlerKey)
38: * @param string $destinationKey
39: */
40: public function __construct(Type $type, Handler $handler, array $handlerKeys, string $destinationKey)
41: {
42: $this->type = $type;
43: $this->handler = $handler;
44: $this->handlerKeys = $handlerKeys;
45: $this->destinationKey = $destinationKey;
46:
47: $this->sourceKeys = array_flip($handlerKeys);
48: }
49:
50: /**
51: * Does a forward transformation step on the data
52: * @param mixed[] $data
53: * @param \Dogma\Mapping\Mapper $mapper
54: */
55: public function stepForward(array &$data, Mapper $mapper): void
56: {
57: $sourceData = [];
58: $onlyNull = true;
59: foreach ($this->handlerKeys as $sourceKey => $handlerKey) {
60: if ($handlerKey === Handler::SINGLE_PARAMETER) {
61: $sourceData = $data[$sourceKey];
62: $onlyNull = false;
63: } else {
64: $sourceData[$handlerKey] = $data[$sourceKey];
65: $onlyNull &= $data[$sourceKey] === null;
66: }
67: unset($data[$sourceKey]);
68: }
69: // skip null
70: if ($onlyNull) {
71: $data[$this->destinationKey] = null;
72: return;
73: }
74: $data[$this->destinationKey] = $this->handler->createInstance($this->type, $sourceData, $mapper);
75: }
76:
77: /**
78: * Does a backward transformation step on the data
79: * @param mixed[] $data
80: * @param \Dogma\Mapping\Mapper $mapper
81: */
82: public function stepBack(array &$data, Mapper $mapper): void
83: {
84: $instance = $data[$this->destinationKey];
85: unset($data[$this->destinationKey]);
86: if ($instance === null) {
87: // expand null
88: foreach ($this->sourceKeys as $sourceKey) {
89: $data[$sourceKey] = null;
90: }
91: return;
92: }
93: $sourceData = $this->handler->exportInstance($this->type, $instance, $mapper);
94: if (isset($this->sourceKeys[Handler::SINGLE_PARAMETER])) {
95: $data[$this->sourceKeys[Handler::SINGLE_PARAMETER]] = $sourceData;
96: } else {
97: foreach ($sourceData as $handlerKey => $value) {
98: $data[$this->sourceKeys[$handlerKey]] = $value;
99: }
100: }
101: }
102:
103: }
| 90 % | Mapping\MetaData\TypeMetaData.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\MetaData;
11:
12: use Dogma\Check;
13: use Dogma\Mapping\Type\Handler;
14: use Dogma\Type;
15:
16: class TypeMetaData
17: {
18: use \Dogma\StrictBehaviorMixin;
19:
20: /** @var \Dogma\Type */
21: private $type;
22:
23: /** @var \Dogma\Type[] (string $name => $type) */
24: private $fields;
25:
26: /** @var \Dogma\Mapping\Type\Handler */
27: private $handler;
28:
29: /**
30: * @param \Dogma\Type $type
31: * @param \Dogma\Type[] $fields ($name => $type)
32: * @param \Dogma\Mapping\Type\Handler $handler
33: */
34: public function __construct(Type $type, array $fields, Handler $handler)
35: {
36: Check::itemsOfType($fields, Type::class);
37:
38: $this->type = $type;
39: $this->fields = $fields;
40: $this->handler = $handler;
41: }
42:
43: public function getType(): Type
44: {
45: return $this->type;
46: }
47:
48: /**
49: * @return \Dogma\Type[] (string $name => $type)
50: */
51: public function getFields(): array
52: {
53: return $this->fields;
54: }
55:
56: public function getHandler(): Handler
57: {
58: return $this->handler;
59: }
60:
61: }
| 95 % | Mapping\MetaData\TypeMetaDataContainer.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\MetaData;
11:
12: use Dogma\Check;
13: use Dogma\Mapping\Type\Handler;
14: use Dogma\Type;
15:
16: class TypeMetaDataContainer
17: {
18: use \Dogma\StrictBehaviorMixin;
19:
20: /** @var \Dogma\Mapping\Type\Handler[] */
21: private $handlers;
22:
23: /** @var \Dogma\Mapping\MetaData\TypeMetaData[] (string $typeId => $typeMetaData) */
24: private $types;
25:
26: /**
27: * @param \Dogma\Mapping\Type\Handler[] $handlers
28: */
29: public function __construct(array $handlers)
30: {
31: Check::itemsOfType($handlers, Handler::class);
32:
33: $this->handlers = $handlers;
34: }
35:
36: public function getType(Type $type): TypeMetaData
37: {
38: $typeId = $type->getId();
39: if (!isset($this->types[$typeId])) {
40: $this->addType($type);
41: }
42:
43: return $this->types[$typeId];
44: }
45:
46: private function addType(Type $type): void
47: {
48: $added = false;
49: foreach ($this->handlers as $handler) {
50: if ($handler->acceptsType($type)) {
51: $params = $handler->getParameters($type);
52: if ($params === null) {
53: $params = [Handler::SINGLE_PARAMETER => Type::get(Type::MIXED)];
54: }
55: $this->types[$type->getId()] = new TypeMetaData($type, $params, $handler);
56: $added = true;
57: }
58: }
59: if (!$added) {
60: throw new \Dogma\Mapping\Type\NoHandlerForTypeException($type);
61: }
62: }
63:
64: }
| 0 % | Mapping\Naming\ConfigShortUnderscoreFieldNamingStrategy.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Naming;
11:
12: use Dogma\Language\Inflector;
13:
14: class ConfigShortUnderscoreFieldNamingStrategy implements \Dogma\Mapping\Naming\NamingStrategy
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var string[][] */
19: private $keyMap;
20:
21: /**
22: * @param string[][] $keyMap ($path => $handlerKey => $sourceKey)
23: */
24: public function __construct(array $keyMap)
25: {
26: $this->keyMap = $keyMap;
27: }
28:
29: public function translateName(string $localName, string $path, string $fieldSeparator): string
30: {
31: $parts = explode($fieldSeparator, $localName);
32:
33: if (isset($this->keyMap[$path][$localName])) {
34: return $this->keyMap[$path][$localName];
35: }
36:
37: return Inflector::underscore(end($parts));
38: }
39:
40: }
| 100 % | Mapping\Naming\NamingStrategy.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Naming;
11:
12: interface NamingStrategy
13: {
14:
15: public function translateName(string $localName, string $path, string $fieldSeparator): string;
16:
17: }
| 100 % | Mapping\Naming\ShortFieldNamingStrategy.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Naming;
11:
12: class ShortFieldNamingStrategy implements \Dogma\Mapping\Naming\NamingStrategy
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: public function translateName(string $localName, string $path, string $fieldSeparator): string
17: {
18: $parts = explode($fieldSeparator, $localName);
19:
20: return end($parts);
21: }
22:
23: }
| 100 % | Mapping\Naming\ShortUnderscoreFieldNamingStrategy.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Naming;
11:
12: use Dogma\Language\Inflector;
13:
14: class ShortUnderscoreFieldNamingStrategy implements \Dogma\Mapping\Naming\NamingStrategy
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: public function translateName(string $localName, string $path, string $fieldSeparator): string
19: {
20: $parts = explode($fieldSeparator, $localName);
21:
22: return Inflector::underscore(end($parts));
23: }
24:
25: }
| 56 % | Mapping\StaticMappingContainer.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping;
11:
12: use Dogma\Type;
13:
14: class StaticMappingContainer implements \Dogma\Mapping\MappingContainer
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var \Dogma\Mapping\Mapping[] (string $typeId => $mapping) */
19: private $mappings;
20:
21: public function __construct(array $mappings)
22: {
23: $this->mappings = $mappings;
24: }
25:
26: public function getMapping(Type $type): Mapping
27: {
28: $typeId = $type->getId();
29: if (!isset($this->mappings[$typeId])) {
30: throw new \Dogma\Mapping\MappingNotFoundException($type);
31: }
32: return $this->mappings[$typeId];
33: }
34:
35: }
| 96 % | Mapping\Type\ArrayHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: use Dogma\Mapping\Mapper;
13: use Dogma\Type;
14:
15: /**
16: * Creates an array containing specified items from raw data and vice versa
17: */
18: class ArrayHandler implements \Dogma\Mapping\Type\Handler
19: {
20: use \Dogma\StrictBehaviorMixin;
21:
22: public function acceptsType(Type $type): bool
23: {
24: return $type->is(Type::PHP_ARRAY);
25: }
26:
27: /**
28: * @param \Dogma\Type $type
29: * @return \Dogma\Type[]|null
30: */
31: public function getParameters(Type $type): ?array
32: {
33: return null;
34: }
35:
36: /**
37: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
38: * @param \Dogma\Type $type
39: * @param mixed[] $items
40: * @param \Dogma\Mapping\Mapper $mapper
41: * @return mixed[]
42: */
43: public function createInstance(Type $type, $items, Mapper $mapper): array
44: {
45: /** @var \Dogma\Type $itemType */
46: $itemType = $type->getItemType();
47: if ($itemType !== null && $itemType->getName() !== Type::MIXED) {
48: $array = [];
49: foreach ($items as $item) {
50: $array[] = $mapper->map($itemType, [Handler::SINGLE_PARAMETER => $item]);
51: }
52: return $array;
53: } else {
54: return $items;
55: }
56: }
57:
58: /**
59: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
60: * @param \Dogma\Type $type
61: * @param mixed[] $instance
62: * @param \Dogma\Mapping\Mapper $mapper
63: * @return mixed[]
64: */
65: public function exportInstance(Type $type, $instance, Mapper $mapper): array
66: {
67: $array = [];
68: if (count($instance) < 1) {
69: return $array;
70: }
71: $itemType = $type->getItemType();
72: // terminate mapping on MIXED
73: if ($itemType === Type::get(Type::MIXED)) {
74: return $instance;
75: }
76: foreach ($instance as $item) {
77: $itemData = $mapper->reverseMap($itemType, $item);
78: if (count($itemData) === 1 && isset($itemData[self::SINGLE_PARAMETER])) {
79: $itemData = $itemData[self::SINGLE_PARAMETER];
80: }
81: $array[] = $itemData;
82: }
83: return $array;
84: }
85:
86: }
| 100 % | Mapping\Type\ConstructorHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: use Dogma\Mapping\Mapper;
13: use Dogma\Reflection\MethodTypeParser;
14: use Dogma\Type;
15: use ReflectionClass;
16:
17: /**
18: * Creates instance via keyword 'new' by filling constructor parameters
19: */
20: abstract class ConstructorHandler implements \Dogma\Mapping\Type\Handler
21: {
22:
23: /** @var \Dogma\Reflection\MethodTypeParser */
24: private $parser;
25:
26: public function __construct(MethodTypeParser $parser)
27: {
28: $this->parser = $parser;
29: }
30:
31: /**
32: * @param \Dogma\Type $type
33: * @return \Dogma\Type[]
34: */
35: public function getParameters(Type $type): array
36: {
37: $class = new ReflectionClass($type->getName());
38: $constructor = $class->getConstructor();
39:
40: return $this->parser->getParameterTypes($constructor);
41: }
42:
43: /**
44: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
45: * @param \Dogma\Type $type
46: * @param mixed[] $parameters
47: * @param \Dogma\Mapping\Mapper $mapper
48: * @return object
49: */
50: public function createInstance(Type $type, $parameters, Mapper $mapper): object
51: {
52: $orderedParams = [];
53: foreach ($this->getParameters($type) as $name => $paramType) {
54: // it is up to class constructor to check the types!
55: $orderedParams[] = $parameters[$name];
56: }
57: return $type->getInstance(...$orderedParams);
58: }
59:
60: }
| 100 % | Mapping\Type\DefaultOneWayHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: use Dogma\Mapping\Mapper;
13: use Dogma\Type;
14:
15: class DefaultOneWayHandler extends \Dogma\Mapping\Type\ConstructorHandler implements \Dogma\Mapping\Type\Handler
16: {
17:
18: public function acceptsType(Type $type): bool
19: {
20: return !$type->isScalar() && !$type->isArray();
21: }
22:
23: /**
24: * @param \Dogma\Type $type
25: * @param mixed $instance
26: * @param \Dogma\Mapping\Mapper $mapper
27: * @throws \Dogma\Mapping\Type\OneWayHandlerException
28: */
29: public function exportInstance(Type $type, $instance, Mapper $mapper): void
30: {
31: throw new \Dogma\Mapping\Type\OneWayHandlerException($instance, $this);
32: }
33:
34: }
| 100 % | Mapping\Type\EnumHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: use Dogma\Enum\IntEnum;
13: use Dogma\Enum\StringEnum;
14: use Dogma\Mapping\Mapper;
15: use Dogma\Type;
16:
17: /**
18: * Creates an enum from raw value and vice versa
19: */
20: class EnumHandler implements \Dogma\Mapping\Type\Handler
21: {
22: use \Dogma\StrictBehaviorMixin;
23:
24: public function acceptsType(Type $type): bool
25: {
26: return $type->isImplementing(IntEnum::class) || $type->isImplementing(StringEnum::class);
27: }
28:
29: /**
30: * @param \Dogma\Type $type
31: * @return string[]|null
32: */
33: public function getParameters(Type $type): ?array
34: {
35: return null;
36: }
37:
38: /**
39: * @param \Dogma\Type $type
40: * @param int|string $value
41: * @param \Dogma\Mapping\Mapper $mapper
42: * @return \Dogma\Enum\IntEnum|\Dogma\Enum\StringEnum
43: */
44: public function createInstance(Type $type, $value, Mapper $mapper)
45: {
46: return call_user_func([$type->getName(), 'get'], $value);
47: }
48:
49: /**
50: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
51: * @param \Dogma\Type $type
52: * @param \Dogma\Enum\IntEnum|\Dogma\Enum\StringEnum $enum
53: * @param \Dogma\Mapping\Mapper $mapper
54: * @return int|string
55: */
56: public function exportInstance(Type $type, $enum, Mapper $mapper)
57: {
58: return $enum->getValue();
59: }
60:
61: }
| 100 % | Mapping\Type\exceptions\Exception.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: interface Exception extends \Dogma\Mapping\Exception
13: {
14:
15: }
| 0 % | Mapping\Type\exceptions\NoHandlerForTypeException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: use Dogma\Type;
13:
14: class NoHandlerForTypeException extends \Dogma\Exception implements \Dogma\Mapping\Type\Exception
15: {
16:
17: /** @var \Dogma\Type */
18: private $type;
19:
20: public function __construct(Type $size, ?\Throwable $previous = null)
21: {
22: parent::__construct(
23: sprintf('No type handler for type %s is registered.', $size->getId()),
24: $previous
25: );
26: $this->type = $size;
27: }
28:
29: public function getType(): Type
30: {
31: return $this->type;
32: }
33:
34: }
| 82 % | Mapping\Type\exceptions\OneWayHandlerException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: class OneWayHandlerException extends \Dogma\Exception implements \Dogma\Mapping\Type\Exception
13: {
14:
15: /** @var mixed */
16: private $instance;
17:
18: /** @var \Dogma\Mapping\Type\Handler */
19: private $handler;
20:
21: /**
22: * @param mixed $instance
23: * @param \Dogma\Mapping\Type\Handler $handler
24: * @param \Throwable|null $previous
25: */
26: public function __construct($instance, Handler $handler, ?\Throwable $previous = null)
27: {
28: parent::__construct(
29: sprintf('Cannot export an instance of %s using one way type handler %s.', get_class($instance), get_class($handler)),
30: $previous
31: );
32: $this->instance = $instance;
33: $this->handler = $handler;
34: }
35:
36: /**
37: * @return mixed
38: */
39: public function getInstance()
40: {
41: return $this->instance;
42: }
43:
44: public function getHandler(): Handler
45: {
46: return $this->handler;
47: }
48:
49: }
| 100 % | Mapping\Type\Exportable.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: /**
13: * Interface converting value objects to scalars.
14: */
15: interface Exportable
16: {
17:
18: /**
19: * @return mixed|mixed[] Scalar value or map of scalar values
20: */
21: public function export();
22:
23: }
| 100 % | Mapping\Type\ExportableHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: use Dogma\Type;
13:
14: /**
15: * Extracts raw data from instance via \Dogma\Exportable interface
16: */
17: class ExportableHandler extends \Dogma\Mapping\Type\ConstructorHandler implements \Dogma\Mapping\Type\Handler
18: {
19: use \Dogma\StrictBehaviorMixin;
20: use \Dogma\Mapping\Type\ExportableHandlerMixin;
21:
22: public function acceptsType(Type $type): bool
23: {
24: return $type->isImplementing(Exportable::class);
25: }
26:
27: }
| 100 % | Mapping\Type\ExportableHandlerMixin.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: use Dogma\Mapping\Mapper;
13: use Dogma\Type;
14:
15: trait ExportableHandlerMixin
16: {
17:
18: /**
19: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
20: * @param \Dogma\Type $type
21: * @param object $instance
22: * @param \Dogma\Mapping\Mapper $mapper
23: * @return mixed[]
24: */
25: public function exportInstance(Type $type, $instance, Mapper $mapper): array
26: {
27: return $instance->export();
28: }
29:
30: }
| 100 % | Mapping\Type\Handler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: use Dogma\Mapping\Mapper;
13: use Dogma\Type;
14:
15: /**
16: * Interface for creating instances from raw data and vice versa
17: */
18: interface Handler
19: {
20:
21: /**
22: * Used as a key in array returned by getParameters().
23: * Indicates only one parameter is expected instead of array.
24: */
25: public const SINGLE_PARAMETER = '';
26:
27: /**
28: * Returns true if handler accepts the type represented by $type parameter.
29: *
30: * @param \Dogma\Type $type
31: * @return bool
32: */
33: public function acceptsType(Type $type): bool;
34:
35: /**
36: * Returns list of parameters where keys are the expected keys in parameters array received by createInstance()
37: * and keys returned by exportInstance(). Values of array are the expected/returned types of parameters.
38: *
39: * When a single parameter is expected (not an array), constant SINGLE_PARAMETER, should be used as the key.
40: *
41: * When both key and type do not matter, value NULL may be returned. NULL is translated by MappingBuilder to:
42: * [Handler::SINGLE_PARAMETER => Type(Type::MIXED)]
43: *
44: * Type::MIXED is the only type, that stops MappingBuilder from further unwrapping the type definition. Use this
45: * type when you don't want the value to be changed at all.
46: *
47: * @param \Dogma\Type $type
48: * @return \Dogma\Type[]|null ($parameterName => $type)
49: */
50: public function getParameters(Type $type): ?array;
51:
52: /**
53: * Expects array of parameters or a single parameter and returns the instantiated value of given type.
54: *
55: * When all parameters are be NULL, only a single NULL value is expected instead of array of NULLs.
56: *
57: * May use given Mapper for mapping some intermediate values.
58: *
59: * @param \Dogma\Type $type
60: * @param mixed|mixed[]|null $parameters
61: * @param \Dogma\Mapping\Mapper $mapper
62: * @return mixed
63: */
64: public function createInstance(Type $type, $parameters, Mapper $mapper);
65:
66: /**
67: * Expects an instance and returns array of its original parameters or a single parameter.
68: *
69: * May use given Mapper for reverse mapping some intermediate values.
70: *
71: * @param \Dogma\Type $type
72: * @param mixed|null $instance
73: * @param \Dogma\Mapping\Mapper $mapper
74: * @return mixed|mixed[]
75: */
76: public function exportInstance(Type $type, $instance, Mapper $mapper);
77:
78: }
| 88 % | Mapping\Type\ScalarsHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: use Dogma\Check;
13: use Dogma\Mapping\Mapper;
14: use Dogma\Type;
15:
16: class ScalarsHandler implements \Dogma\Mapping\Type\Handler
17: {
18:
19: public function acceptsType(Type $type): bool
20: {
21: return $type->isScalar();
22: }
23:
24: /**
25: * @param \Dogma\Type $type
26: * @return \Dogma\Type[]|null
27: */
28: public function getParameters(Type $type): ?array
29: {
30: return null;
31: }
32:
33: /**
34: * @param \Dogma\Type $type
35: * @param mixed $value
36: * @param \Dogma\Mapping\Mapper $mapper
37: * @return mixed
38: */
39: public function createInstance(Type $type, $value, Mapper $mapper)
40: {
41: switch (true) {
42: case $type->isBool():
43: Check::bool($value);
44: return $value;
45: case $type->isInt():
46: Check::int($value);
47: if ($type->getSize() !== null) {
48: Check::bounds($value, $type);
49: }
50: return $value;
51: case $type->isFloat():
52: Check::float($value);
53: if ($type->getSize() !== null) {
54: Check::bounds($value, $type);
55: }
56: return $value;
57: case $type->isString():
58: Check::string($value);
59: return $value;
60: case $type->isNumeric():
61: Check::float($value);
62: $int = (int) $value;
63: if ((float) $int === $value) {
64: return $int;
65: }
66: return $value;
67: default:
68: throw new \Dogma\InvalidTypeException(Type::SCALAR, $value);
69: }
70: }
71:
72: /**
73: * @param \Dogma\Type $type
74: * @param mixed $instance
75: * @param \Dogma\Mapping\Mapper $mapper
76: * @return mixed
77: */
78: public function exportInstance(Type $type, $instance, Mapper $mapper)
79: {
80: if ($type->getSize() !== null) {
81: Check::bounds($instance, $type);
82: }
83: return $instance;
84: }
85:
86: }
| 100 % | Mapping\Type\TupleHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: use Dogma\Mapping\Mapper;
13: use Dogma\Tuple;
14: use Dogma\Type;
15:
16: class TupleHandler implements \Dogma\Mapping\Type\Handler
17: {
18: use \Dogma\StrictBehaviorMixin;
19:
20: public function acceptsType(Type $type): bool
21: {
22: return $type->is(Tuple::class);
23: }
24:
25: /**
26: * @param \Dogma\Type $type
27: * @return \Dogma\Type[]
28: */
29: public function getParameters(Type $type): array
30: {
31: return $type->getItemType();
32: }
33:
34: /**
35: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
36: * @param \Dogma\Type $type
37: * @param mixed[] $items
38: * @param \Dogma\Mapping\Mapper $mapper
39: * @return \Dogma\Tuple
40: */
41: public function createInstance(Type $type, $items, Mapper $mapper): Tuple
42: {
43: return new Tuple(...$items);
44: }
45:
46: /**
47: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
48: * @param \Dogma\Type $type
49: * @param \Dogma\Tuple $instance
50: * @param \Dogma\Mapping\Mapper $mapper
51: * @return mixed[]
52: */
53: public function exportInstance(Type $type, $instance, Mapper $mapper): array
54: {
55: return $instance->toArray();
56: }
57:
58: }
| 100 % | Mapping\Type\TypeHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Mapping\Type;
11:
12: use Dogma\Mapping\Mapper;
13: use Dogma\Type;
14:
15: class TypeHandler implements \Dogma\Mapping\Type\Handler
16: {
17:
18: public function acceptsType(Type $type): bool
19: {
20: return $type->is(Type::class);
21: }
22:
23: /**
24: * @param \Dogma\Type $type
25: * @return \Dogma\Type[]|null
26: */
27: public function getParameters(Type $type): ?array
28: {
29: return null;
30: }
31:
32: /**
33: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
34: * @param \Dogma\Type $type
35: * @param string $typeId
36: * @param \Dogma\Mapping\Mapper $mapper
37: * @return \Dogma\Type
38: */
39: public function createInstance(Type $type, $typeId, Mapper $mapper): Type
40: {
41: return Type::fromId($typeId);
42: }
43:
44: /**
45: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
46: * @param \Dogma\Type $type
47: * @param \Dogma\Type $typeInstance
48: * @param \Dogma\Mapping\Mapper $mapper
49: * @return string
50: */
51: public function exportInstance(Type $type, $typeInstance, Mapper $mapper): string
52: {
53: return $typeInstance->getId();
54: }
55:
56: }
| 98 % | Math\Angle\AngleFormatter.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math\Angle;
11:
12: class AngleFormatter
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: public const DEGREES = 'D';
17: public const DEGREES_FLOORED = 'd';
18: public const MINUTES = 'M';
19: public const MINUTES_FLOORED = 'm';
20: public const SECONDS = 'S';
21: public const SECONDS_FLOORED = 's';
22:
23: public const FORMAT_DEFAULT = 'd:m:S';
24: public const FORMAT_PRETTY = 'd˚m′S″';
25: public const FORMAT_NUMBER = 'D';
26:
27: /** @var string[] */
28: private static $specialCharacters = [
29: self::DEGREES,
30: self::DEGREES_FLOORED,
31: self::MINUTES,
32: self::MINUTES_FLOORED,
33: self::SECONDS,
34: self::SECONDS_FLOORED,
35: ];
36:
37: /** @var string */
38: private $format;
39:
40: /** @var int */
41: private $maxDecimals;
42:
43: /** @var string */
44: private $decimalPoint;
45:
46: public function __construct(string $format = self::FORMAT_DEFAULT, int $maxDecimals = 6, string $decimalPoint = '.')
47: {
48: $this->format = $format;
49: $this->maxDecimals = $maxDecimals;
50: $this->decimalPoint = $decimalPoint;
51: }
52:
53: /**
54: * Ch. Description
55: * ---- -------------------------
56: * Escaping:
57: * % Escape character. Use %% for printing "%"
58: *
59: * Skip groups:
60: * [ Group start, skip if zero
61: * ] Group end, skip if zero
62: *
63: * Objects:
64: * D Degrees with fraction
65: * d Degrees floored
66: * M Minutes with fraction
67: * m Minutes floored
68: * S Seconds with fraction
69: * s Seconds floored
70: *
71: * @param float $degrees
72: * @param string|null $format
73: * @param int|null $maxDecimals
74: * @param string|null $decimalPoint
75: * @return string
76: */
77: public function format(float $degrees, ?string $format = null, ?int $maxDecimals = null, ?string $decimalPoint = null): string
78: {
79: $format = $format ?? $this->format;
80: $maxDecimals = $maxDecimals ?? $this->maxDecimals;
81: $decimalPoint = $decimalPoint ?? $this->decimalPoint;
82:
83: $sign = $degrees < 0;
84: $degrees = abs($degrees);
85:
86: $result = '';
87: $escaped = false;
88: foreach (str_split($format) as $character) {
89: if ($character === '%' && !$escaped) {
90: $escaped = true;
91: } elseif ($escaped === false && in_array($character, self::$specialCharacters)) {
92: switch ($character) {
93: case self::DEGREES:
94: $result .= $this->formatNumber($degrees, $maxDecimals, $decimalPoint);
95: break;
96: case self::DEGREES_FLOORED:
97: $result .= floor($degrees);
98: break;
99: case self::MINUTES:
100: $minutes = ($degrees - floor($degrees)) * 60;
101: $result .= $this->formatNumber($minutes, $maxDecimals, $decimalPoint);
102: break;
103: case self::MINUTES_FLOORED:
104: $minutes = ($degrees - floor($degrees)) * 60;
105: $result .= floor($minutes);
106: break;
107: case self::SECONDS:
108: $minutes = ($degrees - floor($degrees)) * 60;
109: $seconds = ($minutes - floor($minutes)) * 60;
110: $result .= $this->formatNumber($seconds, $maxDecimals, $decimalPoint);
111: break;
112: case self::SECONDS_FLOORED:
113: $minutes = ($degrees - floor($degrees)) * 60;
114: $seconds = ($minutes - floor($minutes)) * 60;
115: $result .= floor($seconds);
116: break;
117: }
118: $escaped = false;
119: } else {
120: $result .= $character;
121: }
122: }
123:
124: return ($sign ? '-' : '') . $result;
125: }
126:
127: private function formatNumber(float $number, int $maxDecimals, string $decimalPoint): string
128: {
129: $number = number_format($number, $maxDecimals, $decimalPoint, '');
130:
131: return rtrim(rtrim($number, '0'), $decimalPoint);
132: }
133:
134: }
| 0 % | Math\Calc.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math;
11:
12: class Calc
13: {
14: use \Dogma\StaticClassMixin;
15:
16: /**
17: * @phpcsSuppress Squiz.Arrays.ArrayDeclaration.ValueNoNewline
18: * @var int[]
19: */
20: private static $primes = [
21: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
22: 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
23: 73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
24: 127, 131, 137, 139, 149, 151, 157, 163, 167, 173,
25: 179, 181, 191, 193, 197, 199, 211, 223, 227, 229,
26: 233, 239, 241, 251, 257, 263, 269, 271, 277, 281,
27: 283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
28: 353, 359, 367, 373, 379, 383, 389, 397, 401, 409,
29: 419, 421, 431, 433, 439, 443, 449, 457, 461, 463,
30: 467, 479, 487, 491, 499, 503, 509, 521, 523, 541,
31: ];
32:
33: /** @var int */
34: private static $lastSieved = 541;
35:
36: /** @var int */
37: private static $sieve;
38:
39: /**
40: * @param int $max
41: * @return int[]
42: */
43: public static function getPrimes(int $max): array
44: {
45: ///
46:
47: return [];
48: }
49:
50: /**
51: * @param int $number
52: * @return int[]
53: */
54: public static function factorize(int $number): array
55: {
56: ///
57:
58: return [];
59: }
60:
61: public static function getGreatestCommonDivider(int $first, int $second): int
62: {
63: if (function_exists('gmp_gcd')) {
64: return gmp_gcd($first, $second);
65: }
66: $firstFactors = self::factorize($first);
67: $secondFactors = self::factorize($second);
68:
69: ///
70: }
71:
72: public static function simplify(Fraction $fraction): Fraction
73: {
74: $gcd = self::getGreatestCommonDivider($fraction->getNumerator(), $fraction->getDenominator());
75:
76: return $gcd > 1 ? new Fraction($fraction->getNumerator() / $gcd, $fraction->getDenominator() / $gcd) : $fraction;
77: }
78:
79: }
| 100 % | Math\Combinatorics.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math;
11:
12: class Combinatorics
13: {
14: use \Dogma\StaticClassMixin;
15:
16: /**
17: * Get all combinations of integers, the given integer can be sum of.
18: * @param int $number
19: * @return int[][]
20: */
21: public static function sumFactorize(int $number): array
22: {
23: if ($number === 1) {
24: return [[1]];
25: }
26: $variants = [[$number]];
27: for ($factor = $number - 1; $factor > 0; $factor--) {
28: $factors = self::sumFactorize($number - $factor);
29: foreach ($factors as $variant) {
30: $variants[] = array_merge([$factor], $variant);
31: };
32: }
33: return $variants;
34: }
35:
36: /**
37: * @param string $string
38: * @return string[][]
39: */
40: public static function getAllSubstringCombinations(string $string): array
41: {
42: $variants = [];
43: foreach (self::sumFactorize(strlen($string)) as $lengths) {
44: $substrings = [];
45: $offset = 0;
46: foreach ($lengths as $length) {
47: $substrings[] = substr($string, $offset, $length);
48: $offset = $offset + $length;
49: };
50: $variants[] = $substrings;
51: };
52: return $variants;
53: }
54:
55: }
| 58 % | Math\Decimal\Decimal.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math\Decimal;
11:
12: use Dogma\ComparisonResult;
13: use Dogma\Round;
14: use Dogma\Sign;
15: use Dogma\Str;
16:
17: /**
18: * Decimal number implemented using bcmath.
19: *
20: * Bcmath scale is calculated so there is no precision loss in basic operations; with the exception of power() and root().
21: * If the arbitrary precise result won't fit into the configured precision, a ValueOutOfBoundsException is thrown.
22: * So it is sure, there are no rounding errors at all.
23: */
24: class Decimal
25: {
26: use \Dogma\StrictBehaviorMixin;
27:
28: private const MAX_SIZE = 65;
29:
30: /** @var string */
31: private $value;
32:
33: /** @var int */
34: private $size;
35:
36: /** @var int */
37: private $precision;
38:
39: /** @var bool */
40: private $integer;
41:
42: /**
43: * @param string|int $value
44: * @param int $size total number of digits
45: * @param int $precision number of digits after decimal point
46: */
47: public function __construct($value, ?int $size = null, ?int $precision = null)
48: {
49: if (is_int($value)) {
50: $value = (string) $value;
51: } elseif (!is_string($value)) {
52: throw new \Dogma\InvalidTypeException('string|int', $value);
53: }
54:
55: list($sign, $int, $fraction) = self::parse($value);
56:
57: if ($precision === null) {
58: $precision = strlen($fraction);
59: }
60: if ($size === null) {
61: $size = strlen($int) + $precision;
62: }
63:
64: self::checkSize($size, $precision);
65:
66: $this->value = $sign . $int . ($fraction ? '.' . $fraction : '');
67:
68: if (strlen($int) > ($size - $precision) || strlen($fraction) > $precision) {
69: throw new \Dogma\ValueOutOfBoundsException($this->value, sprintf('%s(%s,%s)', self::class, $size, $precision));
70: }
71:
72: $this->size = $size;
73: $this->precision = $precision;
74: $this->integer = !$fraction;
75: }
76:
77: public static function checkSize(int $size, int $precision): void
78: {
79: if ($size > self::MAX_SIZE || $size < 1 || $precision < 0) {
80: throw new \Dogma\ValueOutOfBoundsException(sprintf('of type %s(%s,%s)', self::class, $size, $precision), self::class . '(65)');
81: }
82: }
83:
84: /**
85: * @param string $value
86: * @return string[]
87: */
88: private static function parse(string $value): array
89: {
90: $pos = strpos($value, '.');
91: if ($pos === false) {
92: $int = $value;
93: $fraction = '';
94: } else {
95: $int = substr($value, 0, $pos);
96: $fraction = rtrim(substr($value, $pos + 1), '0');
97: }
98: $sign = '';
99: if ($value[0] === '-') {
100: $sign = '-';
101: $int = substr($int, 1);
102: }
103:
104: return [$sign, $int, $fraction];
105: }
106:
107: public function __toString(): string
108: {
109: return sprintf('Decimal(%d,%d): %s', $this->size, $this->precision, $this->value);
110: }
111:
112: // getters ---------------------------------------------------------------------------------------------------------
113:
114: public function getSize(): int
115: {
116: return $this->size;
117: }
118:
119: public function getPrecision(): int
120: {
121: return $this->precision;
122: }
123:
124: public function getMaxValue(): self
125: {
126: return new self(
127: str_repeat('9', $this->size - $this->precision) . ($this->precision ? '.' . str_repeat('9', $this->precision) : ''),
128: $this->size,
129: $this->precision
130: );
131: }
132:
133: public function getCurrentSize(): int
134: {
135: return strlen(str_replace(['-', '.'], ['', ''], $this->value));
136: }
137:
138: public function getCurrentPrecision(): int
139: {
140: return strlen(Str::fromFirst($this->value, '.'));
141: }
142:
143: public function getValue(): string
144: {
145: return $this->value;
146: }
147:
148: public function getSign(): int
149: {
150: return $this->value === '0' ? Sign::NEUTRAL : ($this->value[0] === '-' ? Sign::NEGATIVE : Sign::POSITIVE);
151: }
152:
153: public function isPositive(): bool
154: {
155: return $this->value !== '0' && $this->value[0] !== '-';
156: }
157:
158: public function isNegative(): bool
159: {
160: return $this->value[0] === '-';
161: }
162:
163: public function isZero(): bool
164: {
165: return $this->value === '0';
166: }
167:
168: public function isInteger(): bool
169: {
170: return $this->integer;
171: }
172:
173: /**
174: * @param int|string|\Dogma\Math\Decimal\Decimal $root
175: * @return bool
176: */
177: public function isPowerOf($root): bool
178: {
179: if (!$root instanceof self) {
180: $root = new self($root);
181: }
182: try {
183: $that = $this;
184: switch (true) {
185: case $root->isZero() || $that->isZero():
186: return false;
187: case $root->greaterThan(1):
188: while ($that->greaterThan(1)) {
189: $that = $that->divide($root);
190: if ($that->getValue() === '1') {
191: return true;
192: }
193: }
194: break;
195: case $root->lessThan(-1):
196: while ($that->greaterThan(1) || $that->lessThan(-1)) {
197: $that = $that->divide($root);
198: if ($that->getValue() === '1') {
199: return true;
200: }
201: }
202: break;
203: case $root->greaterThan(0) && $root->lessThan(1):
204: while ($that->greaterThan(0) && $that->lessThan(1)) {
205: $that = $that->divide($root);
206: if ($that->getValue() === '1') {
207: return true;
208: }
209: }
210: break;
211: case $root->greaterThan(-1) && $root->lessThan(0):
212: while ($that->greaterThan(-1) && $that->lessThan(1)) {
213: $that = $that->divide($root);
214: if ($that->getValue() === '1') {
215: return true;
216: }
217: }
218: break;
219: }
220: return false;
221: } catch (\Dogma\ValueOutOfBoundsException $e) {
222: return false;
223: }
224: }
225:
226: /**
227: * @param int|string|\Dogma\Math\Decimal\Decimal $other
228: * @return bool
229: */
230: public function isDivisibleBy($other): bool
231: {
232: if (!$other instanceof self) {
233: $other = new self($other);
234: }
235: try {
236: return $this->divide($other)->isInteger();
237: } catch (\Dogma\ValueOutOfBoundsException $e) {
238: return false;
239: }
240: }
241:
242: public function toFraction(): Fraction
243: {
244: $exponent = $this->getCurrentPrecision();
245: if ($exponent > 0) {
246: $value = $this->getValue();
247: $numerator = new self(str_replace('.', '', $value), $this->getCurrentSize() + $exponent + 2, 2);
248:
249: return self::createSimplifiedFraction($numerator, $exponent);
250: } else {
251: return new Fraction($this, $this->setValue(1));
252: }
253: }
254:
255: private static function createSimplifiedFraction(Decimal $numerator, int $exponent): Fraction
256: {
257: $denominator = $numerator->setValue('1' . str_repeat('0', $exponent));
258: $factors = [];
259: while (count($factors) < $exponent) {
260: if ($numerator->isDivisibleBy(2)) {
261: $factors[] = 2;
262: $numerator = $numerator->divide(2);
263: $denominator = $denominator->divide(2);
264: } else {
265: break;
266: }
267: }
268: while (count($factors) < $exponent) {
269: if ($numerator->isDivisibleBy(5)) {
270: $factors[] = 5;
271: $numerator = $numerator->divide(5);
272: $denominator = $denominator->divide(5);
273: } else {
274: break;
275: }
276: }
277:
278: return new Fraction($numerator, $denominator);
279: }
280:
281: // operators -------------------------------------------------------------------------------------------------------
282:
283: /**
284: * @param int|string $value
285: * @return self
286: */
287: public function setValue($value): self
288: {
289: if (is_int($value)) {
290: $value = (string) $value;
291: } elseif (!is_string($value)) {
292: throw new \Dogma\InvalidTypeException('string|int', $value);
293: }
294: return new self($value, $this->getSize(), $this->getPrecision());
295: }
296:
297: public function setSize(int $size, ?int $precision = null): self
298: {
299: return new self($this->value, $size, $precision !== null ? $precision : $this->precision);
300: }
301:
302: public function setPrecision(int $precision): self
303: {
304: return new self($this->value, $this->size, $precision);
305: }
306:
307: public function abs(): self
308: {
309: if ($this->value[0] === '-') {
310: return new self(substr($this->value, 1), $this->size, $this->precision);
311: }
312: return $this;
313: }
314:
315: public function negate(): self
316: {
317: if ($this->value[0] === '-') {
318: return new self(substr($this->value, 1), $this->size, $this->precision);
319: } else {
320: return new self('-' . $this->value, $this->size, $this->precision);
321: }
322: }
323:
324: /**
325: * @param int|string|\Dogma\Math\Decimal\Decimal$other
326: * @return self
327: */
328: public function add($other): self
329: {
330: if (!$other instanceof self) {
331: $other = new self($other);
332: }
333: $value = bcadd($this->value, $other->value, max($this->precision, $other->precision));
334:
335: return new self($value, $this->size, $this->precision);
336: }
337:
338: /**
339: * @param int|string|\Dogma\Math\Decimal\Decimal $other
340: * @return self
341: */
342: public function subtract($other): self
343: {
344: if (!$other instanceof self) {
345: $other = new self($other);
346: }
347: $value = bcsub($this->value, $other->value, max($this->precision, $other->precision));
348:
349: return new self($value, $this->size, $this->precision);
350: }
351:
352: /**
353: * @param int|string|\Dogma\Math\Decimal\Decimal $multiplier
354: * @return self
355: */
356: public function multiply($multiplier): self
357: {
358: if (!$multiplier instanceof self) {
359: $multiplier = new self($multiplier);
360: }
361: $value = bcmul($this->value, $multiplier->value, $this->precision + $multiplier->precision + 1);
362:
363: return new self($value, $this->size, $this->precision);
364: }
365:
366: /**
367: * @param int|string|\Dogma\Math\Decimal\Decimal $divisor
368: * @return self
369: */
370: public function divide($divisor): self
371: {
372: if (!$divisor instanceof self) {
373: $divisor = new self($divisor);
374: }
375: $value = bcdiv($this->value, $divisor->value, $this->precision + $divisor->precision + 1);
376:
377: return new self($value, $this->size, $this->precision);
378: }
379:
380: /**
381: * Returns result rounded to given precision and reminder over that precision.
382: * @param int|string|\Dogma\Math\Decimal\Decimal $divisor
383: * @return self[]
384: */
385: public function divideWithReminder($divisor): array
386: {
387: if (!$divisor instanceof self) {
388: $divisor = new self($divisor);
389: }
390: $int = (new self(bcdiv($this->value, $divisor->value, 6), self::MAX_SIZE, 6))->clip();
391: $divisor = $divisor->setSize($divisor->getSize() + $int->getCurrentSize());
392: $reminder = $this->subtract($divisor->multiply($int));
393:
394: return [$int->setSize($this->size, $this->precision), $reminder];
395: }
396:
397: /**
398: * Returns remainder after division computed with symmetrical algorithm.
399: * If no precision is given, returned value can have higher precision than left operand value.
400: * @param int|string|\Dogma\Math\Decimal\Decimal $divisor
401: * @return self
402: */
403: public function reminder($divisor): self
404: {
405: if (!$divisor instanceof self) {
406: $divisor = new self($divisor);
407: }
408: return $this->divideWithReminder($divisor)[1];
409: }
410:
411: /**
412: * Returns reminder after integer division.
413: * Always returns an integer. Fraction part of both operands is trimmed.
414: * @param int|string|\Dogma\Math\Decimal\Decimal $modulus
415: * @return self
416: */
417: public function integerModulo($modulus): self
418: {
419: if (!$modulus instanceof self) {
420: $modulus = new self($modulus);
421: }
422: /// does not work in HHVM!
423: $value = bcmod($this->value, $modulus->value);
424: // strange behavior in PHP 7.2+
425: if ($value === '-0') {
426: $value = '0';
427: }
428:
429: return new self($value, $this->size, $this->precision);
430: }
431:
432: /**
433: * @param int|string|\Dogma\Math\Decimal\Decimal $nth
434: * @return self
435: */
436: public function power($nth): self
437: {
438: if (!$nth instanceof self) {
439: $nth = new self($nth);
440: }
441: if (!$nth->isInteger()) {
442: throw new \Dogma\Math\Decimal\DecimalArithmeticException(sprintf(
443: 'Only integer powers are supported. Cannot power by %s.',
444: $nth->getValue()
445: ), $this, $nth);
446: }
447: $value = bcpow($this->value, $nth->value, $this->precision * 2);
448:
449: return new self($value, $this->size, $this->precision);
450: }
451:
452: /**
453: * @param int|string|\Dogma\Math\Decimal\Decimal $nth
454: * @return self
455: */
456: public function root($nth): self
457: {
458: if (!$nth instanceof self) {
459: $nth = new self($nth);
460: }
461: if ($nth->value === '2') {
462: $value = bcsqrt($this->value, $this->precision * 2);
463: } else {
464: $value = bcpow($this->value, bcdiv('1', $nth->value, $this->precision * 2), $this->precision * 2);
465: }
466:
467: return new self($value, $this->size, $this->precision);
468: }
469:
470: public function sqrt(): self
471: {
472: return new self(bcsqrt($this->value, $this->precision * 2), $this->size, $this->precision);
473: }
474:
475: // rounding --------------------------------------------------------------------------------------------------------
476:
477: public function round(int $fractionDigits, int $roundingRule = Round::NORMAL): self
478: {
479: $modulus = new self(bcpow(10, -$fractionDigits), $this->size, $fractionDigits);
480:
481: return $this->roundTo($modulus, $roundingRule);
482: }
483:
484: public function roundUp(int $fractionDigits): self
485: {
486: return $this->round($fractionDigits, Round::UP);
487: }
488:
489: public function roundDown(int $fractionDigits): self
490: {
491: return $this->round($fractionDigits, Round::DOWN);
492: }
493:
494: /**
495: * @param int|string|\Dogma\Math\Decimal\Decimal $modulus
496: * @param int $roundingRule
497: * @return self
498: */
499: public function roundTo($modulus, int $roundingRule = Round::NORMAL): self
500: {
501: if (!$modulus instanceof self) {
502: $modulus = new self($modulus);
503: }
504: $reminder = bcmod($this->value, $modulus->value);
505: if ($reminder === '0') {
506: return $this;
507: }
508:
509: if ($roundingRule === Round::TOWARDS_ZERO) {
510: if ($this->isNegative()) {
511: $roundingRule = Round::UP;
512: } else {
513: $roundingRule = Round::DOWN;
514: }
515: } elseif ($roundingRule === Round::AWAY_FROM_ZERO) {
516: if ($this->isNegative()) {
517: $roundingRule = Round::DOWN;
518: } else {
519: $roundingRule = Round::UP;
520: }
521: }
522:
523: $halfModulus = bcdiv($modulus, 2);
524: if ($roundingRule === Round::NORMAL) {
525: if (bccomp($reminder, $halfModulus) === ComparisonResult::LESSER) {
526: $roundingRule = Round::DOWN;
527: } else {
528: $roundingRule = Round::UP;
529: }
530: } elseif ($this->isNegative()) {
531: $roundingRule = $roundingRule === Round::UP ? Round::DOWN : Round::UP;
532: }
533:
534: $rounded = bcsub($this->value, $reminder);
535: if ($roundingRule === Round::UP) {
536: return new self(bcadd($rounded, $modulus), $this->size, $this->precision);
537: } else {
538: return new self($rounded, $this->size, $this->precision);
539: }
540: }
541:
542: /**
543: * @param int|string|\Dogma\Math\Decimal\Decimal $modulus
544: * @return self
545: */
546: public function roundUpTo($modulus): self
547: {
548: return $this->roundTo($modulus, Round::UP);
549: }
550:
551: /**
552: * @param int|string|\Dogma\Math\Decimal\Decimal $modulus
553: * @return self
554: */
555: public function roundDownTo($modulus): self
556: {
557: return $this->roundTo($modulus, Round::DOWN);
558: }
559:
560: private function clip(int $fractionDigits = 0): self
561: {
562: $sign = $this->isNegative() ? '-' : '';
563: $value = ltrim(Str::toFirst($this->value, '.'), '-');
564: if ($fractionDigits > 0 && strstr($this->value, '.') !== false) {
565: $value .= '.' . substr(Str::fromFirst($this->value, '.'), 0, $fractionDigits);
566: } elseif ($fractionDigits < 0) {
567: if (strlen($value) > -$fractionDigits) {
568: $value = substr($value, 0, $fractionDigits) . str_repeat('0', -$fractionDigits);
569: } else {
570: $value = '0';
571: }
572: }
573: return new self($sign . $value, $this->size, $this->precision);
574: }
575:
576: // comparators -----------------------------------------------------------------------------------------------------
577:
578: public static function compare(self $first, self $second): int
579: {
580: return bccomp($first->value, $second->value, max($first->precision, $second->precision) + 2);
581: }
582:
583: /**
584: * @param int|string|\Dogma\Math\Decimal\Decimal $other
585: * @return bool
586: */
587: public function equals($other): bool
588: {
589: if (!$other instanceof self) {
590: $other = new self($other);
591: }
592: return $this->value === $other->value;
593: }
594:
595: /**
596: * @param int|string|\Dogma\Math\Decimal\Decimal $other
597: * @return bool
598: */
599: public function greaterThan($other): bool
600: {
601: if (!$other instanceof self) {
602: $other = new self($other);
603: }
604: return self::compare($this, $other) === ComparisonResult::GREATER;
605: }
606:
607: /**
608: * @param int|string|\Dogma\Math\Decimal\Decimal $other
609: * @return bool
610: */
611: public function greaterOrEqual($other): bool
612: {
613: if (!$other instanceof self) {
614: $other = new self($other);
615: }
616: return self::compare($this, $other) !== ComparisonResult::LESSER;
617: }
618:
619: /**
620: * @param int|string|\Dogma\Math\Decimal\Decimal $other
621: * @return bool
622: */
623: public function lessThan($other): bool
624: {
625: if (!$other instanceof self) {
626: $other = new self($other);
627: }
628: return self::compare($this, $other) === ComparisonResult::LESSER;
629: }
630:
631: /**
632: * @param int|string|\Dogma\Math\Decimal\Decimal $other
633: * @return bool
634: */
635: public function lessOrEqual($other): bool
636: {
637: if (!$other instanceof self) {
638: $other = new self($other);
639: }
640: return self::compare($this, $other) !== ComparisonResult::GREATER;
641: }
642:
643: }
| 78 % | Math\Decimal\exceptions\DecimalArithmeticException.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Math\Decimal;
4:
5: class DecimalArithmeticException extends \Dogma\Math\MathException
6: {
7:
8: /** @var \Dogma\Math\Decimal\Decimal */
9: private $first;
10:
11: /** @var \Dogma\Math\Decimal\Decimal|null */
12: private $second;
13:
14: public function __construct(string $message, Decimal $first, ?Decimal $second = null, ?\Throwable $previous = null)
15: {
16: parent::__construct($message, $previous);
17:
18: $this->first = $first;
19: $this->second = $second;
20: }
21:
22: public function getFirst(): Decimal
23: {
24: return $this->first;
25: }
26:
27: public function getSecond(): ?Decimal
28: {
29: return $this->second;
30: }
31:
32: }
| 67 % | Math\Decimal\Fraction.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math\Decimal;
11:
12: class Fraction
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var \Dogma\Math\Decimal\Decimal */
17: private $numerator;
18:
19: /** @var \Dogma\Math\Decimal\Decimal */
20: private $denominator;
21:
22: public function __construct(Decimal $numerator, Decimal $denominator)
23: {
24: if (!$numerator->isInteger()) {
25: throw new \Dogma\Math\Decimal\DecimalArithmeticException('Numerator must be an integer', $numerator);
26: }
27: if (!$denominator->isInteger()) {
28: throw new \Dogma\Math\Decimal\DecimalArithmeticException('Denominator must be an integer', $denominator);
29: }
30: $this->numerator = $numerator;
31: $this->denominator = $denominator;
32: }
33:
34: public function __toString(): string
35: {
36: return sprintf('Fraction: %d/%d', $this->numerator->getValue(), $this->denominator->getValue());
37: }
38:
39: public function getNumerator(): Decimal
40: {
41: return $this->numerator;
42: }
43:
44: public function getDenominator(): Decimal
45: {
46: return $this->denominator;
47: }
48:
49: }
| 100 % | Math\exceptions\MathException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math;
11:
12: class MathException extends \Dogma\Exception
13: {
14:
15: }
| 0 % | Math\FloatCalc.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math;
11:
12: class FloatCalc
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public const EPSILON = 0.0000000000001;
17:
18: public static function equals(float $first, float $second, float $epsilon = self::EPSILON): bool
19: {
20: return abs($first - $second) < $epsilon;
21: }
22:
23: }
| 0 % | Math\Fraction.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math;
11:
12: class Fraction
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var int */
17: private $numerator;
18:
19: /** @var int */
20: private $denominator;
21:
22: public function __construct(int $numerator, int $denominator)
23: {
24: $this->numerator = $numerator;
25: $this->denominator = $denominator;
26: }
27:
28: public function __toString(): string
29: {
30: return sprintf('Fraction: %d/%d', $this->numerator, $this->denominator);
31: }
32:
33: public function getNumerator(): int
34: {
35: return $this->numerator;
36: }
37:
38: public function getDenominator(): int
39: {
40: return $this->denominator;
41: }
42:
43: }
| 0 % | Math\Graph\FloydWarshallPathFinder.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math\Graph;
11:
12: /**
13: * Floyd-Warshall algorithm for finding all shortest paths in oriented weighted graph.
14: * All the hard work is done in constructor to enable serialization and caching.
15: *
16: * @see http://en.wikipedia.org/wiki/Floyd–Warshall_algorithm
17: * @see https://github.com/pierre-fromager/PeopleFloydWarshall/blob/4731f8d1e6dd5e659f5945d03ddf8746a578a665/class/floyd-warshall.class.php
18: */
19: class FloydWarshallPathFinder
20: {
21: use \Dogma\StrictBehaviorMixin;
22:
23: /** @var int[] */
24: private $weights;
25:
26: /** @var int */
27: private $nodeCount;
28:
29: /** @var string[] */
30: private $nodeNames;
31:
32: /** @var int[] */
33: private $distances = [[]];
34:
35: /** @var mixed[] */
36: private $predecessors = [[]];
37:
38: /**
39: * @param int[][] $weights graph edge weights. may be sparse
40: */
41: public function __construct(array $weights)
42: {
43: // array: assumption, that all nodes has an outgoing edge
44: if (array_keys($weights) === range(0, count($weights))) {
45: $this->weights = $weights;
46: /// bug: wrong if last nodes has no outgoing edges
47: $this->nodeCount = count($this->weights);
48:
49: // hashmap: replace keys with numeric indexes
50: } else {
51: $n = 0;
52: $nodeNames = [];
53: $normalized = [];
54: foreach ($weights as $i => $nodes) {
55: if (!isset($nodeNames[$i])) {
56: $nodeNames[$i] = $n++;
57: }
58: foreach ($nodes as $j => $weight) {
59: if (!isset($nodeNames[$j])) {
60: $nodeNames[$j] = $n++;
61: }
62: $normalized[$nodeNames[$i]][$nodeNames[$j]] = $weight;
63: }
64: }
65: $this->weights = $normalized;
66: $this->nodeNames = $nodeNames;
67: $this->nodeCount = count($nodeNames);
68: }
69:
70: $this->calculatePaths();
71: }
72:
73: /**
74: * Implementation of Floyd-Warshall algorithm
75: */
76: private function calculatePaths(): void
77: {
78: // init
79: for ($i = 0; $i < $this->nodeCount; $i++) {
80: for ($j = 0; $j < $this->nodeCount; $j++) {
81: if ($i === $j) {
82: $this->distances[$i][$j] = 0;
83: } elseif (isset($this->weights[$i][$j]) && $this->weights[$i][$j] > 0) {
84: $this->distances[$i][$j] = $this->weights[$i][$j];
85: } else {
86: $this->distances[$i][$j] = PHP_INT_MAX;
87: }
88: $this->predecessors[$i][$j] = $i;
89: }
90: }
91:
92: // run
93: for ($k = 0; $k < $this->nodeCount; $k++) {
94: for ($i = 0; $i < $this->nodeCount; $i++) {
95: for ($j = 0; $j < $this->nodeCount; $j++) {
96: if ($this->distances[$i][$j] > ($this->distances[$i][$k] + $this->distances[$k][$j])) {
97: $this->distances[$i][$j] = $this->distances[$i][$k] + $this->distances[$k][$j];
98: $this->predecessors[$i][$j] = $this->predecessors[$k][$j];
99: }
100: }
101: }
102: }
103: }
104:
105: /**
106: * Get total cost (distance) between point a and b
107: * @param int|string $i
108: * @param int|string $j
109: * @return int
110: */
111: public function getDistance($i, $j): int
112: {
113: if (!empty($this->nodeNames)) {
114: $i = $this->nodeNames[$i];
115: $j = $this->nodeNames[$j];
116: }
117:
118: return $this->distances[$i][$j];
119: }
120:
121: /**
122: * Get nodes between a and b
123: * @param int|string $i
124: * @param int|string $j
125: * @return int[]|string[]
126: */
127: public function getPath($i, $j): array
128: {
129: if (!empty($this->nodeNames)) {
130: $i = $this->nodeNames[$i];
131: $j = $this->nodeNames[$j];
132: }
133:
134: $path = [];
135: $k = $j;
136: do {
137: $path[] = $k;
138: $k = $this->predecessors[$i][$k];
139: } while ($i !== $k);
140:
141: return array_reverse($path);
142: }
143:
144: /**
145: * Print out the original Graph matrix in HTML
146: */
147: public function printGraphMatrix(): string
148: {
149: $rt = "<table>\n";
150: if (!empty($this->nodeNames)) {
151: $rt .= '<tr>';
152: $rt .= '<td> </td>';
153: for ($n = 0; $n < $this->nodeCount; $n++) {
154: $rt .= '<td>' . $this->nodeNames[$n] . '</td>';
155: }
156: }
157: $rt .= '</tr>';
158: for ($i = 0; $i < $this->nodeCount; $i++) {
159: $rt .= '<tr>';
160: if (!empty($this->nodeNames)) {
161: $rt .= '<td>' . $this->nodeNames[$i] . '</td>';
162: }
163: for ($j = 0; $j < $this->nodeCount; $j++) {
164: $rt .= '<td>' . $this->weights[$i][$j] . '</td>';
165: }
166: $rt .= '</tr>';
167: }
168: $rt .= '</table>';
169: return $rt;
170: }
171:
172: /**
173: * Print out distances matrix in HTML
174: */
175: public function printDistances(): string
176: {
177: $rt = "<table>\n";
178: if (!empty($this->nodeNames)) {
179: $rt .= '<tr>';
180: $rt .= "<td> </td>\n";
181: for ($n = 0; $n < $this->nodeCount; $n++) {
182: $rt .= '<td>' . $this->nodeNames[$n] . '</td>';
183: }
184: }
185: $rt .= '</tr>';
186: for ($i = 0; $i < $this->nodeCount; $i++) {
187: $rt .= '<tr>';
188: if (!empty($this->nodeNames)) {
189: $rt .= '<td>' . $this->nodeNames[$i] . "</td>\n";
190: }
191: for ($j = 0; $j < $this->nodeCount; $j++) {
192: $rt .= '<td>' . $this->distances[$i][$j] . "</td>\n";
193: }
194: $rt .= '</tr>';
195: }
196: $rt .= "</table>\n";
197: return $rt;
198: }
199:
200: /**
201: * Print out predecessors matrix in HTML
202: */
203: public function printPredecessors(): string
204: {
205: $rt = "<table>\n";
206: if (!empty($this->nodeNames)) {
207: $rt .= '<tr>';
208: $rt .= '<td> </td>';
209: for ($n = 0; $n < $this->nodeCount; $n++) {
210: $rt .= '<td>' . $this->nodeNames[$n] . "</td>\n";
211: }
212: }
213: $rt .= '</tr>';
214: for ($i = 0; $i < $this->nodeCount; $i++) {
215: $rt .= '<tr>';
216: if (!empty($this->nodeNames)) {
217: $rt .= sprintf('<td>%s[%s]</td>', $this->nodeNames[$i], $i) . "\n";
218: }
219: for ($j = 0; $j < $this->nodeCount; $j++) {
220: $rt .= '<td>' . $this->predecessors[$i][$j] . "</td>\n";
221: }
222: $rt .= "</tr>\n";
223: }
224: $rt .= "</table>\n";
225: return $rt;
226: }
227:
228: }
| 97 % | Math\Range\FloatRange.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math\Range;
11:
12: use Dogma\Arr;
13: use Dogma\Check;
14: use Dogma\Type;
15:
16: class FloatRange
17: {
18: use \Dogma\StrictBehaviorMixin;
19:
20: public const MIN = -INF;
21: public const MAX = INF;
22:
23: public const EXCLUSIVE = true;
24: public const INCLUSIVE = false;
25:
26: public const SPLIT_EXCLUSIVE_STARTS = 1;
27: public const SPLIT_SHARED_STARTS_ENDS = 0;
28: public const SPLIT_EXCLUSIVE_ENDS = -1;
29:
30: /** @var float */
31: private $start;
32:
33: /** @var float */
34: private $end;
35:
36: /** @var bool */
37: private $startExclusive;
38:
39: /** @var bool */
40: private $endExclusive;
41:
42: public function __construct(float $start, float $end, bool $startExclusive = false, bool $endExclusive = false)
43: {
44: if (is_nan($start)) {
45: throw new \Dogma\InvalidValueException($start, Type::FLOAT);
46: }
47: if (is_nan($end)) {
48: throw new \Dogma\InvalidValueException($end, Type::FLOAT);
49: }
50: Check::min($end, $start);
51:
52: $this->start = $start;
53: $this->end = $end;
54: $this->startExclusive = $startExclusive;
55: $this->endExclusive = $endExclusive;
56:
57: if ($start === $end) {
58: if ($startExclusive || $endExclusive) {
59: // default createEmpty()
60: $this->start = self::MAX;
61: $this->end = self::MIN;
62: $this->startExclusive = $this->endExclusive = false;
63: }
64: }
65: }
66:
67: public static function createEmpty(): self
68: {
69: $range = new static(0.0, 0.0);
70: $range->start = self::MAX;
71: $range->end = self::MIN;
72:
73: return $range;
74: }
75:
76: public static function createAll(): self
77: {
78: return new static(self::MIN, self::MAX);
79: }
80:
81: // modifications ---------------------------------------------------------------------------------------------------
82:
83: public function shift(float $byValue): self
84: {
85: return new static($this->start + $byValue, $this->end + $byValue, $this->startExclusive, $this->endExclusive);
86: }
87:
88: public function multiply(float $byValue): self
89: {
90: return new static($this->start * $byValue, $this->end * $byValue, $this->startExclusive, $this->endExclusive);
91: }
92:
93: // queries ---------------------------------------------------------------------------------------------------------
94:
95: public function format(?int $decimals = 15, string $decimalPoint = '.'): string
96: {
97: return sprintf(
98: '%s%s, %s%s',
99: $this->startExclusive ? '(' : '[',
100: number_format($this->start, $decimals, $decimalPoint, ''),
101: number_format($this->end, $decimals, $decimalPoint, ''),
102: $this->endExclusive ? ')' : ']'
103: );
104: }
105:
106: public function getStart(): float
107: {
108: return $this->start;
109: }
110:
111: public function getEnd(): float
112: {
113: return $this->end;
114: }
115:
116: public function isStartExclusive(): bool
117: {
118: return $this->startExclusive;
119: }
120:
121: public function isEndExclusive(): bool
122: {
123: return $this->endExclusive;
124: }
125:
126: public function isEmpty(): bool
127: {
128: return $this->start > $this->end || ($this->start === $this->end && $this->startExclusive && $this->endExclusive);
129: }
130:
131: public function equals(self $range): bool
132: {
133: return ($this->start === $range->start
134: && $this->end === $range->end
135: && $this->startExclusive === $range->startExclusive
136: && $this->endExclusive === $range->endExclusive)
137: || ($this->isEmpty() && $range->isEmpty());
138: }
139:
140: public function containsValue(float $value): bool
141: {
142: return ($this->startExclusive ? $value > $this->start : $value >= $this->start)
143: && ($this->endExclusive ? $value < $this->end : $value <= $this->end);
144: }
145:
146: public function contains(self $range): bool
147: {
148: return !$range->isEmpty()
149: && (($this->startExclusive && !$range->startExclusive) ? $range->start > $this->start : $range->start >= $this->start)
150: && (($this->endExclusive && !$range->endExclusive) ? $range->end < $this->end : $range->end <= $this->end);
151: }
152:
153: public function intersects(self $range): bool
154: {
155: /// fujky!
156: return $this->containsValue($range->start) || $this->containsValue($range->end) || $range->containsValue($this->start) || $range->containsValue($this->end);
157: }
158:
159: public function touches(self $range, bool $exclusive = false): bool
160: {
161: return ($this->start === $range->end && ($exclusive ? ($this->startExclusive xor $range->endExclusive) : true))
162: || ($this->end === $range->start && ($exclusive ? ($this->endExclusive xor $range->startExclusive) : true));
163: }
164:
165: // actions ---------------------------------------------------------------------------------------------------------
166:
167: public function split(int $parts, int $splitMode = self::SPLIT_SHARED_STARTS_ENDS): FloatRangeSet
168: {
169: Check::min($parts, 1);
170:
171: if ($this->isEmpty()) {
172: return new FloatRangeSet([$this]);
173: }
174:
175: $partSize = ($this->end - $this->start) / $parts;
176: $borders = [];
177: for ($n = 1; $n < $parts; $n++) {
178: $borders[] = $this->start + $partSize * $n;
179: }
180: $borders = array_unique($borders);
181:
182: return $this->splitBy($borders, $splitMode);
183: }
184:
185: /**
186: * @param float[] $rangeStarts
187: * @param int $splitMode
188: * @return \Dogma\Math\Range\FloatRangeSet
189: */
190: public function splitBy(array $rangeStarts, int $splitMode = self::SPLIT_SHARED_STARTS_ENDS): FloatRangeSet
191: {
192: $rangeStarts = Arr::sort($rangeStarts);
193: $results = [$this];
194: $i = 0;
195: foreach ($rangeStarts as $rangeStart) {
196: /** @var \Dogma\Math\Range\FloatRange $range */
197: $range = $results[$i];
198: if ($range->containsValue($rangeStart)) {
199: $results[$i] = new static($range->start, $rangeStart, $range->startExclusive, $splitMode === self::SPLIT_EXCLUSIVE_ENDS ? self::EXCLUSIVE : self::INCLUSIVE);
200: $results[] = new static($rangeStart, $range->end, $splitMode === self::SPLIT_EXCLUSIVE_STARTS ? self::EXCLUSIVE : self::INCLUSIVE, $range->endExclusive);
201: $i++;
202: }
203: }
204:
205: return new FloatRangeSet($results);
206: }
207:
208: // A1****A2****B1****B2 -> [A1, B2]
209: public function envelope(self ...$items): self
210: {
211: $items[] = $this;
212: $start = self::MAX;
213: $end = self::MIN;
214: $startExclusive = true;
215: $endExclusive = true;
216: foreach ($items as $item) {
217: if ($item->start < $start) {
218: $start = $item->start;
219: $startExclusive = $item->startExclusive;
220: } elseif ($startExclusive && !$item->startExclusive && $item->start === $start) {
221: $startExclusive = false;
222: }
223: if ($item->end > $end) {
224: $end = $item->end;
225: $endExclusive = $item->endExclusive;
226: } elseif ($endExclusive && !$item->endExclusive && $item->end === $end) {
227: $endExclusive = false;
228: }
229: }
230:
231: return new static($start, $end, $startExclusive, $endExclusive);
232: }
233:
234: // A1----B1****A2----B2 -> [B1, A2]
235: // A1----A2 B1----B2 -> [MAX, MIN]
236: public function intersect(self ...$items): self
237: {
238: $items[] = $this;
239: $items = self::sortByStart($items);
240:
241: $result = array_shift($items);
242: /** @var \Dogma\Math\Range\FloatRange $item */
243: foreach ($items as $item) {
244: if ($result->start < $item->start || ($result->start === $item->start && $result->startExclusive && !$item->startExclusive)) {
245: if ($result->end < $item->start || ($result->end === $item->start && ($result->endExclusive || $item->startExclusive))) {
246: return self::createEmpty();
247: }
248: $result = new static(
249: $item->start,
250: $result->end,
251: $item->startExclusive,
252: $result->endExclusive
253: );
254: }
255: if ($result->end > $item->end || ($result->end === $item->end && !$result->endExclusive && $item->endExclusive)) {
256: if ($result->start > $item->end || ($result->start === $item->end && ($result->startExclusive || $item->endExclusive))) {
257: return self::createEmpty();
258: }
259: $result = new static(
260: $result->start,
261: $item->end,
262: $result->startExclusive,
263: $item->endExclusive
264: );
265: }
266: }
267:
268: return $result;
269: }
270:
271: // A1****B1****A2****B2 -> {[A1, B2]}
272: // A1****A2 B1****B2 -> {[A1, A2], [B1, B2]}
273: public function union(self ...$items): FloatRangeSet
274: {
275: $items[] = $this;
276: $items = self::sortByStart($items);
277:
278: $current = array_shift($items);
279: $results = [$current];
280: /** @var \Dogma\Math\Range\FloatRange $item */
281: foreach ($items as $item) {
282: if ($item->isEmpty()) {
283: continue;
284: }
285: if ($current->intersects($item)) {
286: $current = $current->envelope($item);
287: $results[count($results) - 1] = $current;
288: } else {
289: $current = $item;
290: $results[] = $current;
291: }
292: }
293:
294: return new FloatRangeSet($results);
295: }
296:
297: // A xor B
298: // A1****B1----A2****B2 -> {[A1, A2], [B1, B2]}
299: // A1****A2 B1****B2 -> {[A1, A2], [B1, B2]}
300: public function difference(self ...$items): FloatRangeSet
301: {
302: $items[] = $this;
303: $overlaps = self::countOverlaps(...$items);
304:
305: $results = [];
306: foreach ($overlaps as $i => [$item, $count]) {
307: if ($count === 1) {
308: $results[] = $item;
309: }
310: }
311:
312: return new FloatRangeSet($results);
313: }
314:
315: // A minus B
316: // A1****B1----A2----B2 -> {[A1, B1]}
317: // A1****A2 B1----B2 -> {[A1, A2]}
318: public function subtract(self ...$items): FloatRangeSet
319: {
320: $results = [$this];
321:
322: foreach ($items as $item) {
323: if ($item->isEmpty()) {
324: continue;
325: }
326: /** @var \Dogma\Math\Range\FloatRange $range */
327: foreach ($results as $r => $range) {
328: $startLower = $range->start < $item->start || ($range->start === $item->start && !$range->startExclusive && $item->startExclusive);
329: $endHigher = $range->end > $item->end || ($range->end === $item->end && $range->endExclusive && !$item->endExclusive);
330: if ($startLower && $endHigher) {
331: // r1****i1----i2****r2
332: unset($results[$r]);
333: $results[] = new static($range->start, $item->start, $range->startExclusive, !$item->startExclusive);
334: $results[] = new static($item->end, $range->end, !$item->endExclusive, $range->endExclusive);
335: } elseif ($startLower) {
336: if ($range->end < $item->start || ($range->end === $item->start && $range->endExclusive && !$item->startExclusive)) {
337: // r1****r2 i1----i2
338: } else {
339: // r1****i1----r2----i2
340: unset($results[$r]);
341: $results[] = new static($range->start, $item->start, $range->startExclusive, !$item->startExclusive);
342: }
343: } elseif ($endHigher) {
344: if ($range->start > $item->end || ($range->start === $item->end && $range->startExclusive && !$item->endExclusive)) {
345: // i1----i2 r1****r2
346: } else {
347: // i1----r1----i2****r2
348: unset($results[$r]);
349: $results[] = new static($item->end, $range->end, !$item->endExclusive, $range->endExclusive);
350: }
351: } else {
352: // i1----r1----r2----i2
353: unset($results[$r]);
354: }
355: }
356: }
357:
358: return new FloatRangeSet(array_values($results));
359: }
360:
361: // All minus A
362: public function invert(): FloatRangeSet
363: {
364: return self::createAll()->subtract($this);
365: }
366:
367: // static ----------------------------------------------------------------------------------------------------------
368:
369: /**
370: * @param \Dogma\Math\Range\FloatRange ...$items
371: * @return \Dogma\Math\Range\FloatRange[][]|int[][] ($ident => ($range, $count))
372: */
373: public static function countOverlaps(self ...$items): array
374: {
375: $overlaps = self::explodeOverlaps(...$items);
376:
377: $results = [];
378: /** @var \Dogma\Math\Range\FloatRange $overlap */
379: foreach ($overlaps as $overlap) {
380: $ident = $overlap->format();
381: if (isset($results[$ident])) {
382: $results[$ident][1]++;
383: } else {
384: $results[$ident] = [$overlap, 1];
385: }
386: }
387:
388: return array_values($results);
389: }
390:
391: /**
392: * O(n log n)
393: * @param \Dogma\Math\Range\FloatRange ...$items
394: * @return \Dogma\Math\Range\FloatRange[]
395: */
396: public static function explodeOverlaps(self ...$items): array
397: {
398: // 0-5 1-6 2-7 --> 0-1< 1-2< 1-2< 2-5 2-5 2-5 >5-6 >5-6 >6-7
399:
400: $items = self::sort($items);
401: $starts = array_fill(0, count($items), 0);
402: $i = 0;
403: while (isset($items[$i])) {
404: $a = $items[$i];
405: if ($a->isEmpty()) {
406: unset($items[$i]);
407: $i++;
408: continue;
409: }
410: /** @var \Dogma\Math\Range\FloatRange $b */
411: foreach ($items as $j => $b) {
412: if ($i === $j) {
413: continue;
414: } elseif ($j < $starts[$i]) {
415: continue;
416: } elseif ($a->end < $b->start || ($a->end === $b->start && ($a->endExclusive || $b->startExclusive))
417: || $a->start > $b->end || ($a->start === $b->end && ($a->startExclusive || $b->endExclusive))) {
418: // a1----a1 b1----b1
419: } elseif ($a->start === $b->start && $a->startExclusive === $b->startExclusive) {
420: if ($a->end === $b->end && $a->endExclusive === $b->endExclusive) {
421: // a1=b1----a2=b2
422: } elseif ($a->end > $b->end || ($a->end === $b->end && $a->endExclusive === false)) {
423: // a1=b1----b2----a2
424: $items[$i] = $b;
425: $items[] = new static($b->end, $a->end, !$b->endExclusive, $a->endExclusive);
426: $starts[count($items) - 1] = $i + 1;
427: $a = $b;
428: } else {
429: // a1=b1----a2----b2
430: }
431: } elseif ($a->start < $b->start || ($a->start === $b->start && $a->startExclusive === false)) {
432: if ($a->end === $b->end && $a->endExclusive === $b->endExclusive) {
433: // a1----b1----a2=b2
434: $items[$i] = $b;
435: $items[] = new static($a->start, $b->start, $a->startExclusive, !$b->startExclusive);
436: $starts[count($items) - 1] = $i + 1;
437: $a = $b;
438: } elseif ($a->end > $b->end || ($a->end === $b->end && $a->endExclusive === false)) {
439: // a1----b1----b2----a2
440: $items[$i] = $b;
441: $items[] = new static($a->start, $b->start, $a->startExclusive, !$b->startExclusive);
442: $starts[count($items) - 1] = $i + 1;
443: $items[] = new static($b->end, $a->end, !$b->endExclusive, $a->endExclusive);
444: $starts[count($items) - 1] = $i + 1;
445: $a = $b;
446: } else {
447: // a1----b1----a2----b2
448: $new = new static($b->start, $a->end, $b->startExclusive, $a->endExclusive);
449: $items[$i] = $new;
450: $items[] = new static($a->start, $b->start, $a->startExclusive, !$b->startExclusive);
451: $starts[count($items) - 1] = $i + 1;
452: $a = $new;
453: }
454: } else {
455: if ($a->end === $b->end && $a->endExclusive === $b->endExclusive) {
456: // b1----a1----a2=b2
457: } elseif ($a->end > $b->end || ($a->end === $b->end && $a->endExclusive === false)) {
458: // b1----a1----b2----a2
459: $new = new static($a->start, $b->end, $a->startExclusive, $b->endExclusive);
460: $items[$i] = $new;
461: $items[] = new static($b->end, $a->end, !$b->endExclusive, $a->startExclusive);
462: $starts[count($items) - 1] = $i + 1;
463: $a = $new;
464: } else {
465: // b1----a1----a2----b2
466: }
467: }
468: }
469: $i++;
470: }
471:
472: return array_values(self::sort($items));
473: }
474:
475: /**
476: * @param self[] $ranges
477: * @return self[]
478: */
479: public static function sort(array $ranges): array
480: {
481: return Arr::sortWith($ranges, function (FloatRange $a, FloatRange $b) {
482: return $a->start <=> $b->start ?: !$b->startExclusive <=> !$a->startExclusive
483: ?: $a->end <=> $b->end ?: !$b->endExclusive <=> !$a->endExclusive;
484: });
485: }
486:
487: /**
488: * @param self[] $ranges
489: * @return self[]
490: */
491: public static function sortByStart(array $ranges): array
492: {
493: return Arr::sortWith($ranges, function (FloatRange $a, FloatRange $b) {
494: return $a->start <=> $b->start ?: $b->startExclusive <=> $a->startExclusive;
495: });
496: }
497:
498: }
| 40 % | Math\Range\FloatRangeSet.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Math\Range;
4:
5: use Dogma\Check;
6:
7: class FloatRangeSet implements \Dogma\Math\Range\RangeSet
8: {
9: use \Dogma\StrictBehaviorMixin;
10:
11: /** @var \Dogma\Math\Range\FloatRange[] */
12: private $ranges;
13:
14: /**
15: * @param \Dogma\Math\Range\FloatRange[] $ranges
16: */
17: public function __construct(array $ranges)
18: {
19: Check::itemsOfType($ranges, FloatRange::class);
20:
21: $this->ranges = $ranges;
22: }
23:
24: /**
25: * @return \Dogma\Math\Range\FloatRange[]
26: */
27: public function getRanges(): array
28: {
29: return $this->ranges;
30: }
31:
32: public function isEmpty(): bool
33: {
34: return $this->ranges === [];
35: }
36:
37: public function containsValue(float $value): bool
38: {
39: foreach ($this->ranges as $range) {
40: if ($range->containsValue($value)) {
41: return true;
42: }
43: }
44:
45: return false;
46: }
47:
48: public function envelope(): FloatRange
49: {
50: if ($this->ranges === []) {
51: return FloatRange::createEmpty();
52: } else {
53: return end($this->ranges)->envelope(...$this->ranges);
54: }
55: }
56:
57: }
| 100 % | Math\Range\IntRange.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math\Range;
11:
12: use Dogma\Arr;
13: use Dogma\Check;
14:
15: class IntRange implements Range
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: public const MIN = PHP_INT_MIN;
20: public const MAX = PHP_INT_MAX;
21:
22: /** @var int */
23: private $start;
24:
25: /** @var int */
26: private $end;
27:
28: public function __construct(int $start, int $end)
29: {
30: Check::min($end, $start);
31:
32: $this->start = $start;
33: $this->end = $end;
34: }
35:
36: public static function createEmpty(): self
37: {
38: $range = new static(0, 0);
39: $range->start = self::MAX;
40: $range->end = self::MIN;
41:
42: return $range;
43: }
44:
45: public static function createAll(): self
46: {
47: return new static(self::MIN, self::MAX);
48: }
49:
50: // modifications ---------------------------------------------------------------------------------------------------
51:
52: public function shift(int $byValue): self
53: {
54: return new static($this->start + $byValue, $this->end + $byValue);
55: }
56:
57: public function multiply(int $byValue): self
58: {
59: return new static($this->start * $byValue, $this->end * $byValue);
60: }
61:
62: // queries ---------------------------------------------------------------------------------------------------------
63:
64: public function format(): string
65: {
66: return sprintf('[%d, %d]', $this->start, $this->end);
67: }
68:
69: public function getStart(): int
70: {
71: return $this->start;
72: }
73:
74: public function getEnd(): int
75: {
76: return $this->end;
77: }
78:
79: public function isEmpty(): bool
80: {
81: return $this->start > $this->end;
82: }
83:
84: public function equals(self $range): bool
85: {
86: return $this->start === $range->start && $this->end === $range->end;
87: }
88:
89: public function containsValue(int $value): bool
90: {
91: return $value >= $this->start && $value <= $this->end;
92: }
93:
94: public function contains(self $range): bool
95: {
96: return $this->start <= $range->start && $this->end >= $range->end && !$range->isEmpty();
97: }
98:
99: public function intersects(self $range): bool
100: {
101: return ($range->start >= $this->start && $range->start <= $this->end) || ($range->end >= $this->start && $range->end <= $this->end) ;
102: }
103:
104: public function touches(self $range): bool
105: {
106: return $this->start === $range->end + 1 || $this->end === $range->start - 1;
107: }
108:
109: // actions ---------------------------------------------------------------------------------------------------------
110:
111: public function split(int $parts): IntRangeSet
112: {
113: Check::min($parts, 1);
114:
115: if ($this->isEmpty()) {
116: return new IntRangeSet([$this]);
117: }
118:
119: $partSize = ($this->end - $this->start + 1) / $parts;
120: $borders = [];
121: for ($n = 1; $n < $parts; $n++) {
122: $borders[] = (int) round($this->start + $partSize * $n);
123: }
124: $borders = array_unique($borders);
125:
126: if ($borders === []) {
127: return new IntRangeSet([$this]);
128: }
129:
130: return $this->splitBy($borders);
131: }
132:
133: /**
134: * @param int[] $rangeStarts
135: * @return \Dogma\Math\Range\IntRangeSet
136: */
137: public function splitBy(array $rangeStarts): IntRangeSet
138: {
139: $rangeStarts = Arr::sort($rangeStarts);
140: $results = [$this];
141: $i = 0;
142: foreach ($rangeStarts as $rangeStart) {
143: $range = $results[$i];
144: if ($range->containsValue($rangeStart) && $range->containsValue($rangeStart - 1)) {
145: $results[$i] = new static($range->start, $rangeStart - 1);
146: $results[] = new static($rangeStart, $range->end);
147: $i++;
148: }
149: }
150:
151: return new IntRangeSet($results);
152: }
153:
154: // A1****A2****B1****B2 -> [A1, B2]
155: public function envelope(self ...$items): self
156: {
157: $items[] = $this;
158: $start = self::MAX;
159: $end = self::MIN;
160: foreach ($items as $item) {
161: if ($item->start < $start) {
162: $start = $item->start;
163: }
164: if ($item->end > $end) {
165: $end = $item->end;
166: }
167: }
168:
169: return new static($start, $end);
170: }
171:
172: // A and B
173: // A1----B1****A2----B2 -> [B1, A2]
174: // A1----A2 B1----B2 -> [MAX, MIN]
175: public function intersect(self ...$items): self
176: {
177: $items[] = $this;
178: $items = self::sortByStart($items);
179:
180: $result = array_shift($items);
181: /** @var \Dogma\Math\Range\IntRange $item */
182: foreach ($items as $item) {
183: if ($result->end >= $item->start) {
184: $result = new static(max($result->start, $item->start), min($result->end, $item->end));
185: } else {
186: return static::createEmpty();
187: }
188: }
189:
190: return $result;
191: }
192:
193: // A or B
194: // A1****B1****A2****B2 -> {[A1, B2]}
195: // A1****A2 B1****B2 -> {[A1, A2], [B1, B2]}
196: public function union(self ...$items): IntRangeSet
197: {
198: $items[] = $this;
199: $items = self::sortByStart($items);
200:
201: $current = array_shift($items);
202: $results = [$current];
203: /** @var \Dogma\Math\Range\IntRange $item */
204: foreach ($items as $item) {
205: if ($item->isEmpty()) {
206: continue;
207: }
208: if ($current->end >= $item->start - 1) {
209: $current = new static($current->start, max($current->end, $item->end));
210: $results[count($results) - 1] = $current;
211: } else {
212: $current = $item;
213: $results[] = $current;
214: }
215: }
216:
217: return new IntRangeSet($results);
218: }
219:
220: // A xor B
221: // A1****B1----A2****B2 -> {[A1, A2], [B1, B2]}
222: // A1****A2 B1****B2 -> {[A1, A2], [B1, B2]}
223: public function difference(self ...$items): IntRangeSet
224: {
225: $items[] = $this;
226: $overlaps = self::countOverlaps(...$items);
227:
228: $results = [];
229: foreach ($overlaps as $i => [$item, $count]) {
230: if ($count === 1) {
231: $results[] = $item;
232: }
233: }
234:
235: return new IntRangeSet($results);
236: }
237:
238: // A minus B
239: // A1****B1----A2----B2 -> {[A1, B1]}
240: // A1****A2 B1----B2 -> {[A1, A2]}
241: public function subtract(self ...$items): IntRangeSet
242: {
243: $ranges = [$this];
244:
245: foreach ($items as $item) {
246: if ($item->isEmpty()) {
247: continue;
248: }
249: /** @var \Dogma\Math\Range\IntRange $range */
250: foreach ($ranges as $r => $range) {
251: unset($ranges[$r]);
252: if ($range->start < $item->start && $range->end > $item->end) {
253: $ranges[] = new static($range->start, $item->start - 1);
254: $ranges[] = new static($item->end + 1, $range->end);
255: } elseif ($range->start < $item->start) {
256: $ranges[] = new static($range->start, min($range->end, $item->start - 1));
257: } elseif ($range->end > $item->end) {
258: $ranges[] = new static(max($range->start, $item->end + 1), $range->end);
259: }
260: }
261: }
262:
263: return new IntRangeSet(array_values($ranges));
264: }
265:
266: // All minus A
267: public function invert(): IntRangeSet
268: {
269: return self::createAll()->subtract($this);
270: }
271:
272: // static ----------------------------------------------------------------------------------------------------------
273:
274: /**
275: * @param \Dogma\Math\Range\IntRange ...$items
276: * @return \Dogma\Math\Range\IntRange[][]|int[][] ($ident => ($range, $count))
277: */
278: public static function countOverlaps(self ...$items): array
279: {
280: $overlaps = self::explodeOverlaps(...$items);
281:
282: $results = [];
283: /** @var \Dogma\Math\Range\IntRange $overlap */
284: foreach ($overlaps as $overlap) {
285: $ident = $overlap->format();
286: if (isset($results[$ident])) {
287: $results[$ident][1]++;
288: } else {
289: $results[$ident] = [$overlap, 1];
290: }
291: }
292:
293: return array_values($results);
294: }
295:
296: /**
297: * O(n log n)
298: * @param \Dogma\Math\Range\IntRange ...$items
299: * @return \Dogma\Math\Range\IntRange[]
300: */
301: public static function explodeOverlaps(self ...$items): array
302: {
303: // 0-5 1-6 2-7 --> 0-0 1-1 1-1 2-5 2-5 2-5 6-6 6-6 7-7
304:
305: $items = self::sort($items);
306: $starts = array_fill(0, count($items), 0);
307: $i = 0;
308: while (isset($items[$i])) {
309: $a = $items[$i];
310: if ($a->isEmpty()) {
311: unset($items[$i]);
312: $i++;
313: continue;
314: }
315: /** @var \Dogma\Math\Range\IntRange $b */
316: foreach ($items as $j => $b) {
317: if ($j < $starts[$i]) {
318: continue;
319: } elseif ($i === $j) {
320: continue;
321: } elseif ($a->end < $b->start || $a->start > $b->end) {
322: // a1----a1 b1----b1
323: } elseif ($a->start === $b->start) {
324: if ($a->end === $b->end) {
325: // a1=b1----a2=b2
326: } elseif ($a->end > $b->end) {
327: // a1=b1----b2----a2
328: $items[$i] = $b;
329: $items[] = new static($b->end + 1, $a->end);
330: $starts[count($items) - 1] = $i + 1;
331: $a = $b;
332: } else {
333: // a1=b1----a2----b2
334: }
335: } elseif ($a->start < $b->start) {
336: if ($a->end === $b->end) {
337: // a1----b1----a2=b2
338: $items[$i] = $b;
339: $items[] = new static($a->start, $b->start - 1);
340: $starts[count($items) - 1] = $i + 1;
341: $a = $b;
342: } elseif ($a->end > $b->end) {
343: // a1----b1----b2----a2
344: $items[$i] = $b;
345: $items[] = new static($a->start, $b->start - 1);
346: $starts[count($items) - 1] = $i + 1;
347: $items[] = new static($b->end + 1, $a->end);
348: $starts[count($items) - 1] = $i + 1;
349: $a = $b;
350: } else {
351: // a1----b1----a2----b2
352: $new = new static($b->start, $a->end);
353: $items[$i] = $new;
354: $items[] = new static($a->start, $b->start - 1);
355: $starts[count($items) - 1] = $i + 1;
356: $a = $new;
357: }
358: } else {
359: if ($a->end === $b->end) {
360: // b1----a1----a2=b2
361: } elseif ($a->end > $b->end) {
362: // b1----a1----b2----a2
363: $new = new static($a->start, $b->end);
364: $items[$i] = $new;
365: $items[] = new static($b->end + 1, $a->end);
366: $starts[count($items) - 1] = $i + 1;
367: $a = $new;
368: } else {
369: // b1----a1----a2----b2
370: }
371: }
372: }
373: $i++;
374: }
375:
376: return array_values(self::sort($items));
377: }
378:
379: /**
380: * @param self[] $ranges
381: * @return self[]
382: */
383: public static function sort(array $ranges): array
384: {
385: return Arr::sortWith($ranges, function (IntRange $a, IntRange $b) {
386: return $a->start <=> $b->start ?: $a->end <=> $b->end;
387: });
388: }
389:
390: /**
391: * @param self[] $ranges
392: * @return self[]
393: */
394: public static function sortByStart(array $ranges): array
395: {
396: return Arr::sortWith($ranges, function (IntRange $a, IntRange $b) {
397: return $a->start <=> $b->start;
398: });
399: }
400:
401: }
| 40 % | Math\Range\IntRangeSet.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Math\Range;
4:
5: use Dogma\Check;
6:
7: class IntRangeSet implements \Dogma\Math\Range\RangeSet
8: {
9: use \Dogma\StrictBehaviorMixin;
10:
11: /** @var \Dogma\Math\Range\IntRange[] */
12: private $ranges;
13:
14: /**
15: * @param \Dogma\Math\Range\IntRange[] $ranges
16: */
17: public function __construct(array $ranges)
18: {
19: Check::itemsOfType($ranges, IntRange::class);
20:
21: $this->ranges = $ranges;
22: }
23:
24: /**
25: * @return \Dogma\Math\Range\IntRange[]
26: */
27: public function getRanges(): array
28: {
29: return $this->ranges;
30: }
31:
32: public function isEmpty(): bool
33: {
34: return $this->ranges === [];
35: }
36:
37: public function containsValue(int $value): bool
38: {
39: foreach ($this->ranges as $range) {
40: if ($range->containsValue($value)) {
41: return true;
42: }
43: }
44:
45: return false;
46: }
47:
48: public function envelope(): IntRange
49: {
50: if ($this->ranges === []) {
51: return IntRange::createEmpty();
52: } else {
53: return end($this->ranges)->envelope(...$this->ranges);
54: }
55: }
56:
57: }
| 100 % | Math\Range\Range.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Math\Range;
4:
5: interface Range/*<T, RangeSet<T>>*/
6: {
7:
8: // queries ---------------------------------------------------------------------------------------------------------
9:
10: public function format(): string;
11:
12: public function getStart();
13:
14: public function getEnd();
15:
16: public function isEmpty(): bool;
17:
18: //public function equals(self $range): bool;
19:
20: //public function containsValue(T $value): bool;
21:
22: //public function contains(self $range): bool;
23:
24: //public function intersects(self $range): bool;
25:
26: //public function touches(self $range): bool;
27:
28: // actions ---------------------------------------------------------------------------------------------------------
29:
30: public function split(int $parts);//: RangeSet<T>;
31:
32: /**
33: * @param array<T> $rangeStarts
34: * @return \Dogma\Math\Range\RangeSet<T>
35: */
36: public function splitBy(array $rangeStarts);//: RangeSet<T>;
37:
38: // A1****A2****B1****B2 -> [A1, B2]
39: //public function envelope(self ...$items): self;
40:
41: // A and B
42: // A1----B1****A2----B2 -> [B1, A2]
43: // A1----A2 B1----B2 -> [empty]
44: //public function intersect(self ...$items): self;
45:
46: // A or B
47: // A1****B1****A2****B2 -> {[A1, B2]}
48: // A1****A2 B1****B2 -> {[A1, A2], [B1, B2]}
49: //public function union(self ...$items): RangeSet<T>;
50:
51: // A xor B
52: // A1****B1----A2****B2 -> {[A1, A2], [B1, B2]}
53: // A1****A2 B1****B2 -> {[A1, A2], [B1, B2]}
54: //public function difference(self ...$items): RangeSet<T>;
55:
56: // A minus B
57: // A1****B1----A2----B2 -> {[A1, B1]}
58: // A1****A2 B1----B2 -> {[A1, A2]}
59: //public function subtract(self ...$items): RangeSet<T>;
60:
61: // All minus A
62: public function invert();//: RangeSet<T>;
63:
64: // static ----------------------------------------------------------------------------------------------------------
65:
66: /**
67: * @param \Dogma\Math\Range\Range<T> ...$items
68: * @return \Dogma\Math\Range\Range<T>[][]|int[][] ($ident => ($range, $count))
69: */
70: //public static function countOverlaps(self ...$items): array;
71:
72: /**
73: * O(n log n)
74: * @param \Dogma\Math\Range\Range<T> ...$items
75: * @return \Dogma\Math\Range\Range<T>[]
76: */
77: //public static function explodeOverlaps(self ...$items): array;
78:
79: /**
80: * @param self[] $ranges
81: * @return self[]
82: */
83: public static function sort(array $ranges): array;
84:
85: /**
86: * @param self[] $ranges
87: * @return self[]
88: */
89: public static function sortByStart(array $ranges): array;
90:
91: }
| 100 % | Math\Range\RangeSet.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Math\Range;
4:
5: interface RangeSet/*<T>*/
6: {
7:
8: /**
9: * @return \Dogma\Math\Range\Range<T>[]
10: */
11: public function getRanges(): array;
12:
13: public function isEmpty(): bool;
14:
15: //public function containsValue(T $value): bool;
16:
17: public function envelope();//: Range<T>;
18:
19: }
| 0 % | Math\Vector\Vector3.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Math\Vector;
11:
12: use Dogma\Math\FloatCalc;
13:
14: class Vector3
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var float */
19: private $x;
20:
21: /** @var float */
22: private $y;
23:
24: /** @var float */
25: private $z;
26:
27: public function __construct(float $x, float $y, float $z)
28: {
29: $this->x = $x;
30: $this->y = $y;
31: $this->z = $z;
32: }
33:
34: /**
35: * @param float $x
36: * @param float $y
37: * @param float $z
38: * @return float[] ($latRad, $lonRad)
39: */
40: public static function normalVectorToRadians(float $x, float $y, float $z): array
41: {
42: $lonRad = atan2($y, $x);
43: $hyp = sqrt($x * $x + $y * $y);
44: $latRad = atan2($z, $hyp);
45:
46: return [$latRad, $lonRad];
47: }
48:
49: /**
50: * @param float $latRad
51: * @param float $lonRad
52: * @return float[] ($x, $y, $z)
53: */
54: public static function radiansToNormalVector(float $latRad, float $lonRad): array
55: {
56: $x = cos($latRad) * cos($lonRad);
57: $y = cos($latRad) * sin($lonRad);
58: $z = sin($latRad);
59:
60: return [$x, $y, $z];
61: }
62:
63: /**
64: * @param float $x
65: * @param float $y
66: * @param float $z
67: * @return float[]
68: */
69: public static function normalize(float $x, float $y, float $z): array
70: {
71: $size = abs(sqrt($x * $x + $y * $y + $z * $z));
72:
73: if (!FloatCalc::equals($size, 1.0)) {
74: $x = $x / $size;
75: $y = $y / $size;
76: $z = $z / $size;
77: }
78:
79: return [$x, $y, $z];
80: }
81:
82: public static function dotProduct(float $ax, float $ay, float $az, float $bx, float $by, float $bz): float
83: {
84: $dotProduct = $ax * $bx + $ay * $by + $az * $bz;
85:
86: // fixes rounding error on 16th place, which can cause a NAN later
87: if ($dotProduct > 1.0) {
88: $dotProduct = 1.0;
89: } elseif ($dotProduct < -1.0) {
90: $dotProduct = -1.0;
91: }
92:
93: return $dotProduct;
94: }
95:
96: }
| 0 % | Money\BankAccount\Iban.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Money\BankAccount;
11:
12: class Iban
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: ///
17:
18: }
| 0 % | Money\CreditCard\CreditCardIssuer.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Money\CreditCard;
11:
12: class CreditCardIssuer extends \Dogma\Enum\StringEnum
13: {
14:
15: public const AMERICAN_EXPRESS = 'AMEX';
16: public const BANKCARD = 'BACA';
17: public const CHINA_UNIONPAY = 'CHUN';
18: public const DINERS_CLUB_CARTE_BLANCHE = 'DCCB';
19: public const DINERS_CLUB_ENROUTE = 'DCEN';
20: public const DINERS_CLUB_INTERNATIONAL = 'DCIN';
21: public const DINERS_CLUB_UNITED_STATES_AND_CANADA = 'DCUS';
22: public const DISCOVER_CARD = 'DISC';
23: public const INTERPAYMENT = 'INTE';
24: public const INSTAPAYMENT = 'INST';
25: public const JCB = 'JCBX';
26: public const LASER = 'LASR';
27: public const MAESTRO = 'MAES';
28: public const DANKORT = 'DANK';
29: public const MIR = 'MIRX';
30: public const MASTERCARD = 'MAST';
31: public const SOLO = 'SOLO';
32: public const SWITCH = 'SWIT';
33: public const VISA = 'VISA';
34: public const UATP = 'UATP';
35: public const VERVE = 'VERV';
36: public const CARDGUARD_EAD_BG_ILS = 'CAGA';
37:
38: /** @var string[] */
39: private static $names = [
40: self::AMERICAN_EXPRESS => 'American Express',
41: self::BANKCARD => 'Bankcard',
42: self::CHINA_UNIONPAY => 'China UnionPay',
43: self::DINERS_CLUB_CARTE_BLANCHE => 'Diners Club Carte Blanche',
44: self::DINERS_CLUB_ENROUTE => 'Diners Club enRoute',
45: self::DINERS_CLUB_INTERNATIONAL => 'Diners Club International',
46: self::DINERS_CLUB_UNITED_STATES_AND_CANADA => 'Diners Club United States & Canada',
47: self::DISCOVER_CARD => 'Discover Card',
48: self::INTERPAYMENT => 'InterPayment',
49: self::INSTAPAYMENT => 'InstaPayment',
50: self::JCB => 'JCB',
51: self::LASER => 'Laser',
52: self::MAESTRO => 'Maestro',
53: self::DANKORT => 'Dankort',
54: self::MIR => 'MIR',
55: self::MASTERCARD => 'MasterCard',
56: self::SOLO => 'Solo',
57: self::SWITCH => 'Switch',
58: self::VISA => 'Visa',
59: self::UATP => 'UATP',
60: self::VERVE => 'Verve',
61: self::CARDGUARD_EAD_BG_ILS => 'CardGuard EAD BG ILS',
62: ];
63:
64: /** @var string[] */
65: private static $idents = [
66: self::AMERICAN_EXPRESS => 'american-express',
67: self::BANKCARD => 'bankcard',
68: self::CHINA_UNIONPAY => 'china-unionpay',
69: self::DINERS_CLUB_CARTE_BLANCHE => 'diners-club-carte-blanche',
70: self::DINERS_CLUB_ENROUTE => 'diners-club-enroute',
71: self::DINERS_CLUB_INTERNATIONAL => 'diners-club-international',
72: self::DINERS_CLUB_UNITED_STATES_AND_CANADA => 'diners-club-united-states-canada',
73: self::DISCOVER_CARD => 'discover-card',
74: self::INTERPAYMENT => 'interpayment',
75: self::INSTAPAYMENT => 'instapayment',
76: self::JCB => 'jcb',
77: self::LASER => 'laser',
78: self::MAESTRO => 'maestro',
79: self::DANKORT => 'dankort',
80: self::MIR => 'mir',
81: self::MASTERCARD => 'mastercard',
82: self::SOLO => 'solo',
83: self::SWITCH => 'switch',
84: self::VISA => 'visa',
85: self::UATP => 'uatp',
86: self::VERVE => 'verve',
87: self::CARDGUARD_EAD_BG_ILS => 'cardguard-ead-bg-its',
88: ];
89:
90: public static function validateValue(string &$value): bool
91: {
92: $value = strtoupper($value);
93:
94: return parent::validateValue($value);
95: }
96:
97: public function getName(): string
98: {
99: return self::$names[$this->getValue()];
100: }
101:
102: public function getIdent(): string
103: {
104: return self::$idents[$this->getValue()];
105: }
106:
107: public function getByIdent(string $ident): self
108: {
109: return self::get(array_search($ident, self::$idents));
110: }
111:
112: public function getByCreditCardPrefix(): self
113: {
114: ///
115: }
116:
117: }
| 0 % | Money\CreditCard\CreditCardNumber.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Money\CreditCard;
11:
12: class CreditCardNumber
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var string */
17: private $number;
18:
19: public function __construct(string $number)
20: {
21: if (!self::validate($number)) {
22: throw new \Dogma\Money\CreditCard\InvalidCreditCardNumberException($number);
23: }
24: $this->number = $number;
25: }
26:
27: public static function validate(string $number): bool
28: {
29: ///
30: }
31:
32: public static function getIssuerByPrefix(string $prefix): CreditCardIssuer
33: {
34: ///
35: }
36:
37: public function getNumber(): string
38: {
39: return $this->number;
40: }
41:
42: public function getPrefix(): string
43: {
44: return substr($this->number, 0, 6);
45: }
46:
47: public function getSegment(): string
48: {
49: ///
50:
51: return '';
52: }
53:
54: public function getIssuer(): CreditCardIssuer
55: {
56: return self::getIssuerByPrefix($this->getPrefix());
57: }
58:
59: }
| 0 % | Money\CreditCard\exceptions\InvalidCreditCardNumberException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Money\CreditCard;
11:
12: class InvalidCreditCardNumberException extends \Dogma\Exception
13: {
14:
15: /** @var string */
16: private $number;
17:
18: public function __construct(string $number, ?\Throwable $previous = null)
19: {
20: parent::__construct('Given credit card number is not valid.', $previous);
21:
22: $this->number = $number;
23: }
24:
25: public function getNumber(): string
26: {
27: return $this->number;
28: }
29:
30: }
| 0 % | Money\Currency.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Money;
11:
12: class Currency extends \Dogma\Enum\StringEnum
13: {
14:
15: public const AFGHANI = 'AFN';
16: public const ALGERIAN_DINAR = 'DZD';
17: public const ARGENTINE_PESO = 'ARS';
18: public const ARMENIAN_DRAM = 'AMD';
19: public const ARUBAN_FLORIN = 'AWG';
20: public const AUSTRALIAN_DOLLAR = 'AUD';
21: public const AZERBAIJANIAN_MANAT = 'AZN';
22: public const BAHAMIAN_DOLLAR = 'BSD';
23: public const BAHRAINI_DINAR = 'BHD';
24: public const BAHT = 'THB';
25: public const BALBOA = 'PAB';
26: public const BARBADOS_DOLLAR = 'BBD';
27: public const BELARUSIAN_RUBLE = 'BYR';
28: public const BELIZE_DOLLAR = 'BZD';
29: public const BERMUDIAN_DOLLAR = 'BMD';
30: public const BITCOIN = 'XBT';
31: public const BOLIVAR = 'VEF';
32: public const BOLIVIANO = 'BOB';
33: public const BRAZILIAN_REAL = 'BRL';
34: public const BRUNEI_DOLLAR = 'BND';
35: public const BULGARIAN_LEV = 'BGN';
36: public const BURUNDI_FRANC = 'BIF';
37: public const CABO_VERDE_ESCUDO = 'CVE';
38: public const CANADIAN_DOLLAR = 'CAD';
39: public const CAYMAN_ISLANDS_DOLLAR = 'KYD';
40: public const CFA_FRANC_BCEAO = 'XOF';
41: public const CFA_FRANC_BEAC = 'XAF';
42: public const CFP_FRANC = 'XPF';
43: public const CHILEAN_PESO = 'CLP';
44: public const COLOMBIAN_PESO = 'COP';
45: public const COMORO_FRANC = 'KMF';
46: public const CONGOLESE_FRANC = 'CDF';
47: public const CONVERTIBLE_MARK = 'BAM';
48: public const CORDOBA_ORO = 'NIO';
49: public const COSTA_RICAN_COLON = 'CRC';
50: public const CUBAN_PESO = 'CUP';
51: public const CZECH_KORUNA = 'CZK';
52: public const DALASI = 'GMD';
53: public const DANISH_KRONE = 'DKK';
54: public const DENAR = 'MKD';
55: public const DJIBOUTI_FRANC = 'DJF';
56: public const DOBRA = 'STD';
57: public const DOMINICAN_PESO = 'DOP';
58: public const DONG = 'VND';
59: public const EAST_CARIBBEAN_DOLLAR = 'XCD';
60: public const EGYPTIAN_POUND = 'EGP';
61: public const EL_SALVADOR_COLON = 'SVC';
62: public const ETHIOPIAN_BIRR = 'ETB';
63: public const EURO = 'EUR';
64: public const FALKLAND_ISLANDS_POUND = 'FKP';
65: public const FIJI_DOLLAR = 'FJD';
66: public const FORINT = 'HUF';
67: public const GHANA_CEDI = 'GHS';
68: public const GIBRALTAR_POUND = 'GIP';
69: public const GOLD = 'XAU';
70: public const GOURDE = 'HTG';
71: public const GUARANI = 'PYG';
72: public const GUINEA_FRANC = 'GNF';
73: public const GUYANA_DOLLAR = 'GYD';
74: public const HONG_KONG_DOLLAR = 'HKD';
75: public const HRYVNIA = 'UAH';
76: public const ICELAND_KRONA = 'ISK';
77: public const INDIAN_RUPEE = 'INR';
78: public const IRANIAN_RIAL = 'IRR';
79: public const IRAQI_DINAR = 'IQD';
80: public const JAMAICAN_DOLLAR = 'JMD';
81: public const JORDANIAN_DINAR = 'JOD';
82: public const KENYAN_SHILLING = 'KES';
83: public const KINA = 'PGK';
84: public const KIP = 'LAK';
85: public const KUNA = 'HRK';
86: public const KUWAITI_DINAR = 'KWD';
87: public const KWANZA = 'AOA';
88: public const KYAT = 'MMK';
89: public const LARI = 'GEL';
90: public const LEBANESE_POUND = 'LBP';
91: public const LEK = 'ALL';
92: public const LEMPIRA = 'HNL';
93: public const LEONE = 'SLL';
94: public const LIBERIAN_DOLLAR = 'LRD';
95: public const LIBYAN_DINAR = 'LYD';
96: public const LILANGENI = 'SZL';
97: public const LOTI = 'LSL';
98: public const MALAGASY_ARIARY = 'MGA';
99: public const MALAWI_KWACHA = 'MWK';
100: public const MALAYSIAN_RINGGIT = 'MYR';
101: public const MAURITIUS_RUPEE = 'MUR';
102: public const MEXICAN_PESO = 'MXN';
103: public const MOLDOVAN_LEU = 'MDL';
104: public const MOROCCAN_DIRHAM = 'MAD';
105: public const MOZAMBIQUE_METICAL = 'MZN';
106: public const NAIRA = 'NGN';
107: public const NAKFA = 'ERN';
108: public const NAMIBIA_DOLLAR = 'NAD';
109: public const NEPALESE_RUPEE = 'NPR';
110: public const NETHERLANDS_ANTILLEAN_GUILDER = 'ANG';
111: public const NEW_ISRAELI_SHEQEL = 'ILS';
112: public const NEW_TAIWAN_DOLLAR = 'TWD';
113: public const NEW_ZEALAND_DOLLAR = 'NZD';
114: public const NGULTRUM = 'BTN';
115: public const NORTH_KOREAN_WON = 'KPW';
116: public const NORWEGIAN_KRONE = 'NOK';
117: public const OUGUIYA = 'MRO';
118: public const PAANGA = 'TOP';
119: public const PAKISTAN_RUPEE = 'PKR';
120: public const PALLADIUM = 'XPD';
121: public const PATACA = 'MOP';
122: public const PESO_CONVERTIBLE = 'CUC';
123: public const PESO_URUGUAYO = 'UYU';
124: public const PHILIPPINE_PESO = 'PHP';
125: public const PLATINUM = 'XPT';
126: public const POUND_STERLING = 'GBP';
127: public const PULA = 'BWP';
128: public const QATARI_RIAL = 'QAR';
129: public const QUETZAL = 'GTQ';
130: public const RAND = 'ZAR';
131: public const RIAL_OMANI = 'OMR';
132: public const RIEL = 'KHR';
133: public const ROMANIAN_LEU = 'RON';
134: public const RUFIYAA = 'MVR';
135: public const RUPIAH = 'IDR';
136: public const RUSSIAN_RUBLE = 'RUB';
137: public const RWANDA_FRANC = 'RWF';
138: public const SAINT_HELENA_POUND = 'SHP';
139: public const SAUDI_RIYAL = 'SAR';
140: public const SERBIAN_DINAR = 'RSD';
141: public const SEYCHELLES_RUPEE = 'SCR';
142: public const SILVER = 'XAG';
143: public const SINGAPORE_DOLLAR = 'SGD';
144: public const SOL = 'PEN';
145: public const SOLOMON_ISLANDS_DOLLAR = 'SBD';
146: public const SOM = 'KGS';
147: public const SOMALI_SHILLING = 'SOS';
148: public const SOMONI = 'TJS';
149: public const SOUTH_SUDANESE_POUND = 'SSP';
150: public const SRI_LANKA_RUPEE = 'LKR';
151: public const SUDANESE_POUND = 'SDG';
152: public const SURINAM_DOLLAR = 'SRD';
153: public const SWEDISH_KRONA = 'SEK';
154: public const SWISS_FRANC = 'CHF';
155: public const SYRIAN_POUND = 'SYP';
156: public const TAKA = 'BDT';
157: public const TALA = 'WST';
158: public const TANZANIAN_SHILLING = 'TZS';
159: public const TENGE = 'KZT';
160: public const TRINIDAD_AND_TOBAGO_DOLLAR = 'TTD';
161: public const TUGRIK = 'MNT';
162: public const TUNISIAN_DINAR = 'TND';
163: public const TURKISH_LIRA = 'TRY';
164: public const TURKMENISTAN_NEW_MANAT = 'TMT';
165: public const UAE_DIRHAM = 'AED';
166: public const UGANDA_SHILLING = 'UGX';
167: public const US_DOLLAR = 'USD';
168: public const UZBEKISTAN_SUM = 'UZS';
169: public const VATU = 'VUV';
170: public const WON = 'KRW';
171: public const YEMENI_RIAL = 'YER';
172: public const YEN = 'JPY';
173: public const YUAN_RENMINBI = 'CNY';
174: public const ZAMBIAN_KWACHA = 'ZMW';
175: public const ZIMBABWE_DOLLAR = 'ZWL';
176: public const ZLOTY = 'PLN';
177:
178: /** @var string[] */
179: private static $names = [
180: self::AFGHANI => 'Afghani',
181: self::ALGERIAN_DINAR => 'Algerian Dinar',
182: self::ARGENTINE_PESO => 'Argentine Peso',
183: self::ARMENIAN_DRAM => 'Armenian Dram',
184: self::ARUBAN_FLORIN => 'Aruban Florin',
185: self::AUSTRALIAN_DOLLAR => 'Australian Dollar',
186: self::AZERBAIJANIAN_MANAT => 'Azerbaijanian Manat',
187: self::BAHAMIAN_DOLLAR => 'Bahamian Dollar',
188: self::BAHRAINI_DINAR => 'Bahraini Dinar',
189: self::BAHT => 'Baht',
190: self::BALBOA => 'Balboa',
191: self::BARBADOS_DOLLAR => 'Barbados Dollar',
192: self::BELARUSIAN_RUBLE => 'Belarusian Ruble',
193: self::BELIZE_DOLLAR => 'Belize Dollar',
194: self::BERMUDIAN_DOLLAR => 'Bermudian Dollar',
195: self::BITCOIN => 'Bitcoin',
196: self::BOLIVAR => 'Bolívar',
197: self::BOLIVIANO => 'Boliviano',
198: self::BRAZILIAN_REAL => 'Brazilian Real',
199: self::BRUNEI_DOLLAR => 'Brunei Dollar',
200: self::BULGARIAN_LEV => 'Bulgarian Lev',
201: self::BURUNDI_FRANC => 'Burundi Franc',
202: self::CABO_VERDE_ESCUDO => 'Cabo Verde Escudo',
203: self::CANADIAN_DOLLAR => 'Canadian Dollar',
204: self::CAYMAN_ISLANDS_DOLLAR => 'Cayman Islands Dollar',
205: self::CFA_FRANC_BCEAO => 'CFA Franc BCEAO',
206: self::CFA_FRANC_BEAC => 'CFA Franc BEAC',
207: self::CFP_FRANC => 'CFP Franc',
208: self::CHILEAN_PESO => 'Chilean Peso',
209: self::COLOMBIAN_PESO => 'Colombian Peso',
210: self::COMORO_FRANC => 'Comoro Franc',
211: self::CONGOLESE_FRANC => 'Congolese Franc',
212: self::CONVERTIBLE_MARK => 'Convertible Mark',
213: self::CORDOBA_ORO => 'Cordoba Oro',
214: self::COSTA_RICAN_COLON => 'Costa Rican Colon',
215: self::CUBAN_PESO => 'Cuban Peso',
216: self::CZECH_KORUNA => 'Czech Koruna',
217: self::DALASI => 'Dalasi',
218: self::DANISH_KRONE => 'Danish Krone',
219: self::DENAR => 'Denar',
220: self::DJIBOUTI_FRANC => 'Djibouti Franc',
221: self::DOBRA => 'Dobra',
222: self::DOMINICAN_PESO => 'Dominican Peso',
223: self::DONG => 'Dong',
224: self::EAST_CARIBBEAN_DOLLAR => 'East Caribbean Dollar',
225: self::EGYPTIAN_POUND => 'Egyptian Pound',
226: self::EL_SALVADOR_COLON => 'El Salvador Colon',
227: self::ETHIOPIAN_BIRR => 'Ethiopian Birr',
228: self::EURO => 'Euro',
229: self::FALKLAND_ISLANDS_POUND => 'Falkland Islands Pound',
230: self::FIJI_DOLLAR => 'Fiji Dollar',
231: self::FORINT => 'Forint',
232: self::GHANA_CEDI => 'Ghana Cedi',
233: self::GIBRALTAR_POUND => 'Gibraltar Pound',
234: self::GOLD => 'Gold',
235: self::GOURDE => 'Gourde',
236: self::GUARANI => 'Guarani',
237: self::GUINEA_FRANC => 'Guinea Franc',
238: self::GUYANA_DOLLAR => 'Guyana Dollar',
239: self::HONG_KONG_DOLLAR => 'Hong Kong Dollar',
240: self::HRYVNIA => 'Hryvnia',
241: self::ICELAND_KRONA => 'Iceland Krona',
242: self::INDIAN_RUPEE => 'Indian Rupee',
243: self::IRANIAN_RIAL => 'Iranian Rial',
244: self::IRAQI_DINAR => 'Iraqi Dinar',
245: self::JAMAICAN_DOLLAR => 'Jamaican Dollar',
246: self::JORDANIAN_DINAR => 'Jordanian Dinar',
247: self::KENYAN_SHILLING => 'Kenyan Shilling',
248: self::KINA => 'Kina',
249: self::KIP => 'Kip',
250: self::KUNA => 'Kuna',
251: self::KUWAITI_DINAR => 'Kuwaiti Dinar',
252: self::KWANZA => 'Kwanza',
253: self::KYAT => 'Kyat',
254: self::LARI => 'Lari',
255: self::LEBANESE_POUND => 'Lebanese Pound',
256: self::LEK => 'Lek',
257: self::LEMPIRA => 'Lempira',
258: self::LEONE => 'Leone',
259: self::LIBERIAN_DOLLAR => 'Liberian Dollar',
260: self::LIBYAN_DINAR => 'Libyan Dinar',
261: self::LILANGENI => 'Lilangeni',
262: self::LOTI => 'Loti',
263: self::MALAGASY_ARIARY => 'Malagasy Ariary',
264: self::MALAWI_KWACHA => 'Malawi Kwacha',
265: self::MALAYSIAN_RINGGIT => 'Malaysian Ringgit',
266: self::MAURITIUS_RUPEE => 'Mauritius Rupee',
267: self::MEXICAN_PESO => 'Mexican Peso',
268: self::MOLDOVAN_LEU => 'Moldovan Leu',
269: self::MOROCCAN_DIRHAM => 'Moroccan Dirham',
270: self::MOZAMBIQUE_METICAL => 'Mozambique Metical',
271: self::NAIRA => 'Naira',
272: self::NAKFA => 'Nakfa',
273: self::NAMIBIA_DOLLAR => 'Namibia Dollar',
274: self::NEPALESE_RUPEE => 'Nepalese Rupee',
275: self::NETHERLANDS_ANTILLEAN_GUILDER => 'Netherlands Antillean Guilder',
276: self::NEW_ISRAELI_SHEQEL => 'New Israeli Sheqel',
277: self::NEW_TAIWAN_DOLLAR => 'New Taiwan Dollar',
278: self::NEW_ZEALAND_DOLLAR => 'New Zealand Dollar',
279: self::NGULTRUM => 'Ngultrum',
280: self::NORTH_KOREAN_WON => 'North Korean Won',
281: self::NORWEGIAN_KRONE => 'Norwegian Krone',
282: self::OUGUIYA => 'Ouguiya',
283: self::PAANGA => 'Pa’anga',
284: self::PAKISTAN_RUPEE => 'Pakistan Rupee',
285: self::PALLADIUM => 'Palladium',
286: self::PATACA => 'Pataca',
287: self::PESO_CONVERTIBLE => 'Peso Convertible',
288: self::PESO_URUGUAYO => 'Peso Uruguayo',
289: self::PHILIPPINE_PESO => 'Philippine Peso',
290: self::PLATINUM => 'Platinum',
291: self::POUND_STERLING => 'Pound Sterling',
292: self::PULA => 'Pula',
293: self::QATARI_RIAL => 'Qatari Rial',
294: self::QUETZAL => 'Quetzal',
295: self::RAND => 'Rand',
296: self::RIAL_OMANI => 'Rial Omani',
297: self::RIEL => 'Riel',
298: self::ROMANIAN_LEU => 'Romanian Leu',
299: self::RUFIYAA => 'Rufiyaa',
300: self::RUPIAH => 'Rupiah',
301: self::RUSSIAN_RUBLE => 'Russian Ruble',
302: self::RWANDA_FRANC => 'Rwanda Franc',
303: self::SAINT_HELENA_POUND => 'Saint Helena Pound',
304: self::SAUDI_RIYAL => 'Saudi Riyal',
305: self::SERBIAN_DINAR => 'Serbian Dinar',
306: self::SEYCHELLES_RUPEE => 'Seychelles Rupee',
307: self::SILVER => 'Silver',
308: self::SINGAPORE_DOLLAR => 'Singapore Dollar',
309: self::SOL => 'Sol',
310: self::SOLOMON_ISLANDS_DOLLAR => 'Solomon Islands Dollar',
311: self::SOM => 'Som',
312: self::SOMALI_SHILLING => 'Somali Shilling',
313: self::SOMONI => 'Somoni',
314: self::SOUTH_SUDANESE_POUND => 'South Sudanese Pound',
315: self::SRI_LANKA_RUPEE => 'Sri Lanka Rupee',
316: self::SUDANESE_POUND => 'Sudanese Pound',
317: self::SURINAM_DOLLAR => 'Surinam Dollar',
318: self::SWEDISH_KRONA => 'Swedish Krona',
319: self::SWISS_FRANC => 'Swiss Franc',
320: self::SYRIAN_POUND => 'Syrian Pound',
321: self::TAKA => 'Taka',
322: self::TALA => 'Tala',
323: self::TANZANIAN_SHILLING => 'Tanzanian Shilling',
324: self::TENGE => 'Tenge',
325: self::TRINIDAD_AND_TOBAGO_DOLLAR => 'Trinidad and Tobago Dollar',
326: self::TUGRIK => 'Tugrik',
327: self::TUNISIAN_DINAR => 'Tunisian Dinar',
328: self::TURKISH_LIRA => 'Turkish Lira',
329: self::TURKMENISTAN_NEW_MANAT => 'Turkmenistan New Manat',
330: self::UAE_DIRHAM => 'UAE Dirham',
331: self::UGANDA_SHILLING => 'Uganda Shilling',
332: self::US_DOLLAR => 'US Dollar',
333: self::UZBEKISTAN_SUM => 'Uzbekistan Sum',
334: self::VATU => 'Vatu',
335: self::WON => 'Won',
336: self::YEMENI_RIAL => 'Yemeni Rial',
337: self::YEN => 'Yen',
338: self::YUAN_RENMINBI => 'Yuan Renminbi',
339: self::ZAMBIAN_KWACHA => 'Zambian Kwacha',
340: self::ZIMBABWE_DOLLAR => 'Zimbabwe Dollar',
341: self::ZLOTY => 'Zloty',
342: ];
343:
344: /** @var string[] */
345: private static $idents = [
346: self::AFGHANI => 'afghani',
347: self::ALGERIAN_DINAR => 'algerian-dinar',
348: self::ARGENTINE_PESO => 'argentine-peso',
349: self::ARMENIAN_DRAM => 'armenian-dram',
350: self::ARUBAN_FLORIN => 'aruban-florin',
351: self::AUSTRALIAN_DOLLAR => 'australian-dollar',
352: self::AZERBAIJANIAN_MANAT => 'azerbaijanian-manat',
353: self::BAHAMIAN_DOLLAR => 'bahamian-dollar',
354: self::BAHRAINI_DINAR => 'bahraini-dinar',
355: self::BAHT => 'baht',
356: self::BALBOA => 'balboa',
357: self::BARBADOS_DOLLAR => 'barbados-dollar',
358: self::BELARUSIAN_RUBLE => 'belarusian-ruble',
359: self::BELIZE_DOLLAR => 'belize-dollar',
360: self::BERMUDIAN_DOLLAR => 'bermudian-dollar',
361: self::BITCOIN => 'bitcoin',
362: self::BOLIVAR => 'bolivar',
363: self::BOLIVIANO => 'boliviano',
364: self::BRAZILIAN_REAL => 'brazilian-real',
365: self::BRUNEI_DOLLAR => 'brunei-dollar',
366: self::BULGARIAN_LEV => 'bulgarian-lev',
367: self::BURUNDI_FRANC => 'burundi-franc',
368: self::CABO_VERDE_ESCUDO => 'cabo-verde-escudo',
369: self::CANADIAN_DOLLAR => 'canadian-dollar',
370: self::CAYMAN_ISLANDS_DOLLAR => 'cayman-islands-dollar',
371: self::CFA_FRANC_BCEAO => 'cfa-franc-bceao',
372: self::CFA_FRANC_BEAC => 'cfa-franc-beac',
373: self::CFP_FRANC => 'cfp-franc',
374: self::CHILEAN_PESO => 'chilean-peso',
375: self::COLOMBIAN_PESO => 'colombian-peso',
376: self::COMORO_FRANC => 'comoro-franc',
377: self::CONGOLESE_FRANC => 'congolese-franc',
378: self::CONVERTIBLE_MARK => 'convertible-mark',
379: self::CORDOBA_ORO => 'cordoba-oro',
380: self::COSTA_RICAN_COLON => 'costa-rican-colon',
381: self::CUBAN_PESO => 'cuban-peso',
382: self::CZECH_KORUNA => 'czech-koruna',
383: self::DALASI => 'dalasi',
384: self::DANISH_KRONE => 'danish-krone',
385: self::DENAR => 'denar',
386: self::DJIBOUTI_FRANC => 'djibouti-franc',
387: self::DOBRA => 'dobra',
388: self::DOMINICAN_PESO => 'dominican-peso',
389: self::DONG => 'dong',
390: self::EAST_CARIBBEAN_DOLLAR => 'east-caribbean-dollar',
391: self::EGYPTIAN_POUND => 'egyptian-pound',
392: self::EL_SALVADOR_COLON => 'el-salvador-colon',
393: self::ETHIOPIAN_BIRR => 'ethiopian-birr',
394: self::EURO => 'euro',
395: self::FALKLAND_ISLANDS_POUND => 'falkland-islands-pound',
396: self::FIJI_DOLLAR => 'fiji-dollar',
397: self::FORINT => 'forint',
398: self::GHANA_CEDI => 'ghana-cedi',
399: self::GIBRALTAR_POUND => 'gibraltar-pound',
400: self::GOLD => 'gold',
401: self::GOURDE => 'gourde',
402: self::GUARANI => 'guarani',
403: self::GUINEA_FRANC => 'guinea-franc',
404: self::GUYANA_DOLLAR => 'guyana-dollar',
405: self::HONG_KONG_DOLLAR => 'hong-kong-dollar',
406: self::HRYVNIA => 'hryvnia',
407: self::ICELAND_KRONA => 'iceland-krona',
408: self::INDIAN_RUPEE => 'indian-rupee',
409: self::IRANIAN_RIAL => 'iranian-rial',
410: self::IRAQI_DINAR => 'iraqi-dinar',
411: self::JAMAICAN_DOLLAR => 'jamaican-dollar',
412: self::JORDANIAN_DINAR => 'jordanian-dinar',
413: self::KENYAN_SHILLING => 'kenyan-shilling',
414: self::KINA => 'kina',
415: self::KIP => 'kip',
416: self::KUNA => 'kuna',
417: self::KUWAITI_DINAR => 'kuwaiti-dinar',
418: self::KWANZA => 'kwanza',
419: self::KYAT => 'kyat',
420: self::LARI => 'lari',
421: self::LEBANESE_POUND => 'lebanese-pound',
422: self::LEK => 'lek',
423: self::LEMPIRA => 'lempira',
424: self::LEONE => 'leone',
425: self::LIBERIAN_DOLLAR => 'liberian-dollar',
426: self::LIBYAN_DINAR => 'libyan-dinar',
427: self::LILANGENI => 'lilangeni',
428: self::LOTI => 'loti',
429: self::MALAGASY_ARIARY => 'malagasy-ariary',
430: self::MALAWI_KWACHA => 'malawi-kwacha',
431: self::MALAYSIAN_RINGGIT => 'malaysian-ringgit',
432: self::MAURITIUS_RUPEE => 'mauritius-rupee',
433: self::MEXICAN_PESO => 'mexican-peso',
434: self::MOLDOVAN_LEU => 'moldovan-leu',
435: self::MOROCCAN_DIRHAM => 'moroccan-dirham',
436: self::MOZAMBIQUE_METICAL => 'mozambique-metical',
437: self::NAIRA => 'naira',
438: self::NAKFA => 'nakfa',
439: self::NAMIBIA_DOLLAR => 'namibia-dollar',
440: self::NEPALESE_RUPEE => 'nepalese-rupee',
441: self::NETHERLANDS_ANTILLEAN_GUILDER => 'netherlands-antillean-guilder',
442: self::NEW_ISRAELI_SHEQEL => 'new-israeli-sheqel',
443: self::NEW_TAIWAN_DOLLAR => 'new-taiwan-dollar',
444: self::NEW_ZEALAND_DOLLAR => 'new-zealand-dollar',
445: self::NGULTRUM => 'ngultrum',
446: self::NORTH_KOREAN_WON => 'north-korean-won',
447: self::NORWEGIAN_KRONE => 'norwegian-krone',
448: self::OUGUIYA => 'ouguiya',
449: self::PAANGA => 'paanga',
450: self::PAKISTAN_RUPEE => 'pakistan-rupee',
451: self::PALLADIUM => 'palladium',
452: self::PATACA => 'pataca',
453: self::PESO_CONVERTIBLE => 'peso-convertible',
454: self::PESO_URUGUAYO => 'peso-uruguayo',
455: self::PHILIPPINE_PESO => 'philippine-peso',
456: self::PLATINUM => 'platinum',
457: self::POUND_STERLING => 'pound-sterling',
458: self::PULA => 'pula',
459: self::QATARI_RIAL => 'qatari-rial',
460: self::QUETZAL => 'quetzal',
461: self::RAND => 'rand',
462: self::RIAL_OMANI => 'rial-omani',
463: self::RIEL => 'riel',
464: self::ROMANIAN_LEU => 'romanian-leu',
465: self::RUFIYAA => 'rufiyaa',
466: self::RUPIAH => 'rupiah',
467: self::RUSSIAN_RUBLE => 'russian-ruble',
468: self::RWANDA_FRANC => 'rwanda-franc',
469: self::SAINT_HELENA_POUND => 'saint-helena-pound',
470: self::SAUDI_RIYAL => 'saudi-riyal',
471: self::SERBIAN_DINAR => 'serbian-dinar',
472: self::SEYCHELLES_RUPEE => 'seychelles-rupee',
473: self::SILVER => 'silver',
474: self::SINGAPORE_DOLLAR => 'singapore-dollar',
475: self::SOL => 'sol',
476: self::SOLOMON_ISLANDS_DOLLAR => 'solomon-islands-dollar',
477: self::SOM => 'som',
478: self::SOMALI_SHILLING => 'somali-shilling',
479: self::SOMONI => 'somoni',
480: self::SOUTH_SUDANESE_POUND => 'south-sudanese-pound',
481: self::SRI_LANKA_RUPEE => 'sri-lanka-rupee',
482: self::SUDANESE_POUND => 'sudanese-pound',
483: self::SURINAM_DOLLAR => 'surinam-dollar',
484: self::SWEDISH_KRONA => 'swedish-krona',
485: self::SWISS_FRANC => 'swiss-franc',
486: self::SYRIAN_POUND => 'syrian-pound',
487: self::TAKA => 'taka',
488: self::TALA => 'tala',
489: self::TANZANIAN_SHILLING => 'tanzanian-shilling',
490: self::TENGE => 'tenge',
491: self::TRINIDAD_AND_TOBAGO_DOLLAR => 'trinidad-and-tobago-dollar',
492: self::TUGRIK => 'tugrik',
493: self::TUNISIAN_DINAR => 'tunisian-dinar',
494: self::TURKISH_LIRA => 'turkish-lira',
495: self::TURKMENISTAN_NEW_MANAT => 'turkmenistan-new-manat',
496: self::UAE_DIRHAM => 'uae-dirham',
497: self::UGANDA_SHILLING => 'uganda-shilling',
498: self::US_DOLLAR => 'us-dollar',
499: self::UZBEKISTAN_SUM => 'uzbekistan-sum',
500: self::VATU => 'vatu',
501: self::WON => 'won',
502: self::YEMENI_RIAL => 'yemeni-rial',
503: self::YEN => 'yen',
504: self::YUAN_RENMINBI => 'yuan-renminbi',
505: self::ZAMBIAN_KWACHA => 'zambian-kwacha',
506: self::ZIMBABWE_DOLLAR => 'zimbabwe-dollar',
507: self::ZLOTY => 'zloty',
508: ];
509:
510: public function getName(): string
511: {
512: return self::$names[$this->getValue()];
513: }
514:
515: public function getIdent(): string
516: {
517: return self::$idents[$this->getValue()];
518: }
519:
520: public function getByIdent(string $ident): self
521: {
522: return self::get(array_search($ident, self::$idents));
523: }
524:
525: public static function validateValue(string &$value): bool
526: {
527: $value = strtoupper($value);
528:
529: return parent::validateValue($value);
530: }
531:
532: }
| 0 % | Money\Money.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Money;
11:
12: use Dogma\Math\Decimal\Decimal;
13:
14: class Money
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var \Dogma\Money\Currency */
19: private $currency;
20:
21: /** @var \Dogma\Math\Decimal\Decimal */
22: private $amount;
23:
24: /** @var int */
25: private $precision;
26:
27: public function __construct(Currency $currency, Decimal $amount)
28: {
29: $this->currency = $currency;
30: $this->amount = $amount;
31: $this->precision = $amount->getPrecision();
32: }
33:
34: ///
35:
36: }
| 0 % | People\Address\GeocodedAddress.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Address;
11:
12: use Dogma\Country\Country;
13: use Dogma\Geolocation\Position;
14: use Dogma\People\Address\State\State;
15:
16: class GeocodedAddress extends \Dogma\People\Address\StreetAddress
17: {
18:
19: /** @var \Dogma\Geolocation\Position */
20: private $position;
21:
22: public function __construct(
23: Position $position,
24: Country $country,
25: string $city,
26: string $street,
27: ?string $zipCode = null,
28: ?string $cityPart = null,
29: ?string $district = null,
30: ?string $region = null,
31: ?State $state = null
32: )
33: {
34: parent::__construct($country, $city, $street, $zipCode, $cityPart, $district, $region, $state);
35:
36: $this->position = $position;
37: }
38:
39: public function getPosition(): Position
40: {
41: return $this->position;
42: }
43:
44: }
| 0 % | People\Address\Region\Region.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Address\Region;
11:
12: interface Region
13: {
14:
15: public function getValue(): int;
16:
17: public function getShortcut(): string;
18:
19: public function getName(): string;
20:
21: public function getCity(): string;
22:
23: }
| 0 % | People\Address\Region\RegionCz.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Address\Region;
11:
12: class RegionCz extends \Dogma\Enum\IntEnum implements \Dogma\People\Address\Region\Region
13: {
14:
15: public const PRAGUE = 1;
16: public const CENTRAL_BOHEMIA = 2;
17: public const SOUTH_BOHEMIA = 3;
18: public const PLZEN = 4;
19: public const KARLOVY_VARY = 5;
20: public const USTI_NAD_LABEM = 6;
21: public const LIBEREC = 7;
22: public const HRADEC_KRALOVE = 8;
23: public const PARDUBICE = 9;
24: public const HIGHLANDS = 10;
25: public const SOUTH_MORAVIA = 11;
26: public const OLOMOUC = 12;
27: public const MORAVIA_SILESIA = 13;
28: public const ZLIN = 14;
29:
30: /** @var string[] */
31: private static $shortcuts = [
32: self::PRAGUE => 'A',
33: self::CENTRAL_BOHEMIA => 'S',
34: self::SOUTH_BOHEMIA => 'C',
35: self::PLZEN => 'P',
36: self::KARLOVY_VARY => 'K',
37: self::USTI_NAD_LABEM => 'U',
38: self::LIBEREC => 'L',
39: self::HRADEC_KRALOVE => 'H',
40: self::PARDUBICE => 'E',
41: self::HIGHLANDS => 'J',
42: self::SOUTH_MORAVIA => 'B',
43: self::OLOMOUC => 'M',
44: self::MORAVIA_SILESIA => 'T',
45: self::ZLIN => 'Z',
46: ];
47:
48: public function getShortcut(): string
49: {
50: return self::$shortcuts[$this->getValue()];
51: }
52:
53: /** @var string[] */
54: private static $shortcuts3 = [
55: self::PRAGUE => 'PHA',
56: self::CENTRAL_BOHEMIA => 'STČ',
57: self::SOUTH_BOHEMIA => 'JHČ',
58: self::PLZEN => 'PLK',
59: self::KARLOVY_VARY => 'KVK',
60: self::USTI_NAD_LABEM => 'ULK',
61: self::LIBEREC => 'LBK',
62: self::HRADEC_KRALOVE => 'HKK',
63: self::PARDUBICE => 'PAK',
64: self::HIGHLANDS => 'VYS',
65: self::SOUTH_MORAVIA => 'JHM',
66: self::OLOMOUC => 'OLK',
67: self::MORAVIA_SILESIA => 'MSK',
68: self::ZLIN => 'ZLK',
69: ];
70:
71: public function getShortcut3(): string
72: {
73: return self::$shortcuts3[$this->getValue()];
74: }
75:
76: /** @var string[] */
77: private static $names = [
78: self::PRAGUE => 'Hlavní město Praha',
79: self::CENTRAL_BOHEMIA => 'Středočeský kraj',
80: self::SOUTH_BOHEMIA => 'Jihočeský kraj',
81: self::PLZEN => 'Plzeňský kraj',
82: self::KARLOVY_VARY => 'Karlovarský kraj',
83: self::USTI_NAD_LABEM => 'Ústecký kraj',
84: self::LIBEREC => 'Liberecký kraj',
85: self::HRADEC_KRALOVE => 'Královéhradecký kraj',
86: self::PARDUBICE => 'Pardubický kraj',
87: self::HIGHLANDS => 'Kraj Vysočina',
88: self::SOUTH_MORAVIA => 'Jihomoravský kraj',
89: self::OLOMOUC => 'Olomoucký kraj',
90: self::MORAVIA_SILESIA => 'Moravskoslezský kraj',
91: self::ZLIN => 'Zlínský kraj',
92: ];
93:
94: public function getName(): string
95: {
96: return self::$names[$this->getValue()];
97: }
98:
99: /** @var string[] */
100: private static $cities = [
101: self::PRAGUE => 'Praha',
102: self::CENTRAL_BOHEMIA => 'Praha',
103: self::SOUTH_BOHEMIA => 'České Budějovice',
104: self::PLZEN => 'Plzeň',
105: self::KARLOVY_VARY => 'Karlovy Vary',
106: self::USTI_NAD_LABEM => 'Ústí nad Labem',
107: self::LIBEREC => 'Liberec',
108: self::HRADEC_KRALOVE => 'Hradec Králové',
109: self::PARDUBICE => 'Pardubice',
110: self::HIGHLANDS => 'Jihlava',
111: self::SOUTH_MORAVIA => 'Brno',
112: self::OLOMOUC => 'Olomouc',
113: self::MORAVIA_SILESIA => 'Ostrava',
114: self::ZLIN => 'Zlín',
115: ];
116:
117: public function getCity(): string
118: {
119: return self::$cities[$this->getValue()];
120: }
121:
122: }
| 0 % | People\Address\State\State.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Address\State;
11:
12: interface State
13: {
14:
15: public function getValue(): string;
16:
17: public function getName(): string;
18:
19: public function getIdent(): string;
20:
21: }
| 0 % | People\Address\State\StateCa.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Address\State;
11:
12: use Dogma\Str;
13:
14: class StateCa extends \Dogma\Enum\StringEnum implements \Dogma\People\Address\State\State
15: {
16:
17: public const ONTARIO = 'ON';
18: public const QUEBEC = 'QC';
19: public const NOVA_SCOTIA = 'NS';
20: public const NEW_BRUNSWICK = 'NB';
21: public const MANITOBA = 'MB';
22: public const BRITISH_COLUMBIA = 'BC';
23: public const PRINCE_EDWARD_ISLAND = 'PE';
24: public const SASKATCHEWAN = 'SK';
25: public const ALBERTA = 'AB';
26: public const NEWFOUNDLAND_AND_LABRADOR = 'NL';
27:
28: /** @var string[] */
29: private static $names = [
30: self::ONTARIO => 'Ontario',
31: self::QUEBEC => 'Quebec',
32: self::NOVA_SCOTIA => 'Nova Scotia',
33: self::NEW_BRUNSWICK => 'New Brunswick',
34: self::MANITOBA => 'Manitoba',
35: self::BRITISH_COLUMBIA => 'British Columbia',
36: self::PRINCE_EDWARD_ISLAND => 'Prince Edward Island',
37: self::SASKATCHEWAN => 'Saskatchewan',
38: self::ALBERTA => 'Alberta',
39: self::NEWFOUNDLAND_AND_LABRADOR => 'Newfoundland and Labrador',
40: ];
41:
42: public function getName(): string
43: {
44: return self::$names[$this->getValue()];
45: }
46:
47: public function getIdent(): string
48: {
49: return Str::webalize($this->getName());
50: }
51:
52: public static function validateValue(string &$value): bool
53: {
54: $value = strtoupper($value);
55:
56: return parent::validateValue($value);
57: }
58:
59: }
| 0 % | People\Address\State\StateUs.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Address\State;
11:
12: use Dogma\Str;
13:
14: class StateUs extends \Dogma\Enum\StringEnum implements \Dogma\People\Address\State\State
15: {
16:
17: public const ALABAMA = 'AL';
18: public const ALASKA = 'AK';
19: public const ARIZONA = 'AZ';
20: public const ARKANSAS = 'AR';
21: public const CALIFORNIA = 'CA';
22: public const COLORADO = 'CO';
23: public const CONNECTICUT = 'CT';
24: public const DELAWARE = 'DE';
25: public const FLORIDA = 'FL';
26: public const GEORGIA = 'GA';
27: public const HAWAII = 'HI';
28: public const IDAHO = 'ID';
29: public const ILLINOIS = 'IL';
30: public const INDIANA = 'IN';
31: public const IOWA = 'IA';
32: public const KANSAS = 'KS';
33: public const KENTUCKY = 'KY';
34: public const LOUISIANA = 'LA';
35: public const MAINE = 'ME';
36: public const MARYLAND = 'MD';
37: public const MASSACHUSETTS = 'MA';
38: public const MICHIGAN = 'MI';
39: public const MINNESOTA = 'MN';
40: public const MISSISSIPPI = 'MS';
41: public const MISSOURI = 'MO';
42: public const MONTANA = 'MT';
43: public const NEBRASKA = 'NE';
44: public const NEVADA = 'NV';
45: public const NEW_HAMPSHIRE = 'NH';
46: public const NEW_JERSEY = 'NJ';
47: public const NEW_MEXICO = 'NM';
48: public const NEW_YORK = 'NY';
49: public const NORTH_CAROLINA = 'NC';
50: public const NORTH_DAKOTA = 'ND';
51: public const OHIO = 'OH';
52: public const OKLAHOMA = 'OK';
53: public const OREGON = 'OR';
54: public const PENNSYLVANIA = 'PA';
55: public const RHODE_ISLAND = 'RI';
56: public const SOUTH_CAROLINA = 'SC';
57: public const SOUTH_DAKOTA = 'SD';
58: public const TENNESSEE = 'TN';
59: public const TEXAS = 'TX';
60: public const UTAH = 'UT';
61: public const VERMONT = 'VT';
62: public const VIRGINIA = 'VA';
63: public const WASHINGTON = 'WA';
64: public const WEST_VIRGINIA = 'WV';
65: public const WISCONSIN = 'WI';
66: public const WYOMING = 'WY';
67:
68: /** @var string[] */
69: private static $names = [
70: self::ALABAMA => 'Alabama',
71: self::ALASKA => 'Alaska',
72: self::ARIZONA => 'Arizona',
73: self::ARKANSAS => 'Arkansas',
74: self::CALIFORNIA => 'California',
75: self::COLORADO => 'Colorado',
76: self::CONNECTICUT => 'Connecticut',
77: self::DELAWARE => 'Delaware',
78: self::FLORIDA => 'Florida',
79: self::GEORGIA => 'Georgia',
80: self::HAWAII => 'Hawaii',
81: self::IDAHO => 'Idaho',
82: self::ILLINOIS => 'Illinois',
83: self::INDIANA => 'Indiana',
84: self::IOWA => 'Iowa',
85: self::KANSAS => 'Kansas',
86: self::KENTUCKY => 'Kentucky',
87: self::LOUISIANA => 'Louisiana',
88: self::MAINE => 'Maine',
89: self::MARYLAND => 'Maryland',
90: self::MASSACHUSETTS => 'Massachusetts',
91: self::MICHIGAN => 'Michigan',
92: self::MINNESOTA => 'Minnesota',
93: self::MISSISSIPPI => 'Mississippi',
94: self::MISSOURI => 'Missouri',
95: self::MONTANA => 'Montana',
96: self::NEBRASKA => 'Nebraska',
97: self::NEVADA => 'Nevada',
98: self::NEW_HAMPSHIRE => 'New Hampshire',
99: self::NEW_JERSEY => 'New Jersey',
100: self::NEW_MEXICO => 'New Mexico',
101: self::NEW_YORK => 'New York',
102: self::NORTH_CAROLINA => 'North Carolina',
103: self::NORTH_DAKOTA => 'North Dakota',
104: self::OHIO => 'Ohio',
105: self::OKLAHOMA => 'Oklahoma',
106: self::OREGON => 'Oregon',
107: self::PENNSYLVANIA => 'Pennsylvania',
108: self::RHODE_ISLAND => 'Rhode Island',
109: self::SOUTH_CAROLINA => 'South Carolina',
110: self::SOUTH_DAKOTA => 'South Dakota',
111: self::TENNESSEE => 'Tennessee',
112: self::TEXAS => 'Texas',
113: self::UTAH => 'Utah',
114: self::VERMONT => 'Vermont',
115: self::VIRGINIA => 'Virginia',
116: self::WASHINGTON => 'Washington',
117: self::WEST_VIRGINIA => 'West Virginia',
118: self::WISCONSIN => 'Wisconsin',
119: self::WYOMING => 'Wyoming',
120: ];
121:
122: public function getName(): string
123: {
124: return self::$names[$this->getValue()];
125: }
126:
127: public function getIdent(): string
128: {
129: return Str::webalize($this->getName());
130: }
131:
132: public static function validateValue(string &$value): bool
133: {
134: $value = strtoupper($value);
135:
136: return parent::validateValue($value);
137: }
138:
139: }
| 0 % | People\Address\StreetAddress.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Address;
11:
12: use Dogma\Country\Country;
13: use Dogma\People\Address\State\State;
14:
15: /**
16: * Street address without a person, company or flat information
17: */
18: class StreetAddress
19: {
20: use \Dogma\StrictBehaviorMixin;
21:
22: /** @var \Dogma\Country\Country */
23: private $country;
24:
25: /** @var \Dogma\People\Address\State\State|null */
26: private $state;
27:
28: /** @var string|null */
29: private $region;
30:
31: /** @var string|null */
32: private $district;
33:
34: /** @var string */
35: private $city;
36:
37: /** @var string|null */
38: private $cityPart;
39:
40: /** @var string */
41: private $street;
42:
43: /** @var string|null */
44: private $zipCode;
45:
46: public function __construct(
47: Country $country,
48: string $city,
49: string $street,
50: ?string $zipCode = null,
51: ?string $cityPart = null,
52: ?string $district = null,
53: ?string $region = null,
54: ?State $state = null
55: ) {
56: $this->country = $country;
57: $this->state = $state;
58: $this->region = $region;
59: $this->district = $district;
60: $this->city = $city;
61: $this->cityPart = $cityPart;
62: $this->street = $street;
63: $this->zipCode = $zipCode;
64: }
65:
66: public function getCountry(): Country
67: {
68: return $this->country;
69: }
70:
71: public function getState(): ?State
72: {
73: return $this->state;
74: }
75:
76: public function getRegion(): ?string
77: {
78: return $this->region;
79: }
80:
81: public function getDistrict(): ?string
82: {
83: return $this->district;
84: }
85:
86: public function getCity(): string
87: {
88: return $this->city;
89: }
90:
91: public function getCityPart(): ?string
92: {
93: return $this->cityPart;
94: }
95:
96: public function getStreet(): string
97: {
98: return $this->street;
99: }
100:
101: public function getZipCode(): ?string
102: {
103: return $this->zipCode;
104: }
105:
106: }
| 0 % | People\Im\ImAccount.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Im;
11:
12: use Dogma\Time\Date;
13:
14: class ImAccount
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var \Dogma\People\Im\ImAccountType */
19: private $type;
20:
21: /** @var string */
22: private $nickName;
23:
24: /** @var string */
25: private $identifier;
26:
27: /** @var string|null */
28: private $provider;
29:
30: /** @var \Dogma\Time\Date|null */
31: private $createdTime;
32:
33: public function __construct(
34: ImAccountType $type,
35: string $nickName,
36: string $identifier,
37: ?string $provider = null,
38: ?Date $createdDate = null
39: )
40: {
41: $this->type = $type;
42: $this->nickName = $nickName;
43: $this->identifier = $identifier;
44: $this->provider = $provider;
45: $this->createdTime = $createdDate;
46: }
47:
48: }
| 0 % | People\Im\ImAccountType.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Im;
11:
12: class ImAccountType extends \Dogma\Enum\PartialStringEnum
13: {
14:
15: ///
16:
17: }
| 0 % | People\Person\Gender.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Person;
11:
12: class Gender extends \Dogma\Enum\IntEnum
13: {
14:
15: public const MALE = 1;
16: public const FEMALE = 2;
17:
18: }
| 0 % | People\Person\Generation.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Person;
11:
12: class Generation extends \Dogma\Enum\IntEnum
13: {
14:
15: public const YOUNGER = 1;
16: public const OLDER = 2;
17: public const YOUNGEST = 3;
18: public const OLDEST = 4;
19:
20: }
| 0 % | People\Person\Person.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Person;
11:
12: use Dogma\Time\Date;
13:
14: class Person
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var string|null */
19: private $firstName;
20:
21: /** @var string|null */
22: private $lastName;
23:
24: /** @var string[] */
25: private $middleNames;
26:
27: /** @var string|null */
28: private $prefixDegree;
29:
30: /** @var string|null */
31: private $suffixDegree;
32:
33: /** @var \Dogma\People\Person\Gender|null */
34: private $gender;
35:
36: /** @var \Dogma\People\Person\Generation|null */
37: private $generation;
38:
39: /** @var \Dogma\Time\Date|null */
40: private $birthDate;
41:
42: /** @var \Dogma\Time\Date|null */
43: private $deceasedDate;
44:
45: public function __construct()
46: {
47: ///
48: }
49:
50: public function getFirstName(): ?string
51: {
52: return $this->firstName;
53: }
54:
55: public function getLastName(): ?string
56: {
57: return $this->lastName;
58: }
59:
60: /**
61: * @return string[]
62: */
63: public function getMiddleNames(): array
64: {
65: return $this->middleNames;
66: }
67:
68: public function getPrefixDegree(): ?string
69: {
70: return $this->prefixDegree;
71: }
72:
73: public function getSuffixDegree(): ?string
74: {
75: return $this->suffixDegree;
76: }
77:
78: public function getGender(): ?Gender
79: {
80: return $this->gender;
81: }
82:
83: public function getGeneration(): ?Generation
84: {
85: return $this->generation;
86: }
87:
88: public function getBirthDate(): ?Date
89: {
90: return $this->birthDate;
91: }
92:
93: public function getDeceasedDate(): ?Date
94: {
95: return $this->deceasedDate;
96: }
97:
98: }
| 0 % | People\Phone\PhoneNumber.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Phone;
11:
12: class PhoneNumber
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var string */
17: private $number;
18:
19: /** @var \Dogma\People\Phone\PhonePrefix|null */
20: private $prefix;
21:
22: public function __construct(string $number)
23: {
24: ///
25: $this->number = $number;
26: }
27:
28: public function getCountryPrefix(): ?PhonePrefix
29: {
30: return $this->prefix;
31: }
32:
33: }
| 0 % | People\Phone\PhonePrefix.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\People\Phone;
11:
12: use Dogma\Arr;
13: use Dogma\Country\Country;
14:
15: class PhonePrefix extends \Dogma\Enum\IntEnum
16: {
17:
18: public const PLUS_1 = 1;
19: public const PLUS_1242 = 1242;
20: public const PLUS_1246 = 1246;
21: public const PLUS_1264 = 1264;
22: public const PLUS_1268 = 1268;
23: public const PLUS_1284 = 1284;
24: public const PLUS_1340 = 1340;
25: public const PLUS_1345 = 1345;
26: public const PLUS_1441 = 1441;
27: public const PLUS_1473 = 1473;
28: public const PLUS_1646 = 1646;
29: public const PLUS_1649 = 1649;
30: public const PLUS_1670 = 1670;
31: public const PLUS_1671 = 1671;
32: public const PLUS_1684 = 1684;
33: public const PLUS_1721 = 1721;
34: public const PLUS_1758 = 1758;
35: public const PLUS_1767 = 1767;
36: public const PLUS_1784 = 1784;
37: public const PLUS_1787 = 1787;
38: public const PLUS_1809 = 1809;
39: public const PLUS_1829 = 1829;
40: public const PLUS_1849 = 1849;
41: public const PLUS_1867 = 1867;
42: public const PLUS_1868 = 1868;
43: public const PLUS_1869 = 1869;
44: public const PLUS_1939 = 1939;
45: public const PLUS_20 = 20;
46: public const PLUS_211 = 211;
47: public const PLUS_212 = 212;
48: public const PLUS_213 = 213;
49: public const PLUS_216 = 216;
50: public const PLUS_218 = 218;
51: public const PLUS_220 = 220;
52: public const PLUS_221 = 221;
53: public const PLUS_222 = 222;
54: public const PLUS_223 = 223;
55: public const PLUS_224 = 224;
56: public const PLUS_225 = 225;
57: public const PLUS_226 = 226;
58: public const PLUS_227 = 227;
59: public const PLUS_228 = 228;
60: public const PLUS_229 = 229;
61: public const PLUS_230 = 230;
62: public const PLUS_231 = 231;
63: public const PLUS_232 = 232;
64: public const PLUS_233 = 233;
65: public const PLUS_234 = 234;
66: public const PLUS_235 = 235;
67: public const PLUS_236 = 236;
68: public const PLUS_237 = 237;
69: public const PLUS_238 = 238;
70: public const PLUS_239 = 239;
71: public const PLUS_240 = 240;
72: public const PLUS_241 = 241;
73: public const PLUS_242 = 242;
74: public const PLUS_243 = 243;
75: public const PLUS_244 = 244;
76: public const PLUS_245 = 245;
77: public const PLUS_246 = 246;
78: public const PLUS_248 = 248;
79: public const PLUS_249 = 249;
80: public const PLUS_250 = 250;
81: public const PLUS_251 = 251;
82: public const PLUS_252 = 252;
83: public const PLUS_253 = 253;
84: public const PLUS_254 = 254;
85: public const PLUS_255 = 255;
86: public const PLUS_256 = 256;
87: public const PLUS_257 = 257;
88: public const PLUS_258 = 258;
89: public const PLUS_260 = 260;
90: public const PLUS_261 = 261;
91: public const PLUS_262 = 262;
92: public const PLUS_263 = 263;
93: public const PLUS_264 = 264;
94: public const PLUS_265 = 265;
95: public const PLUS_266 = 266;
96: public const PLUS_267 = 267;
97: public const PLUS_268 = 268;
98: public const PLUS_269 = 269;
99: public const PLUS_27 = 27;
100: public const PLUS_290 = 290;
101: public const PLUS_291 = 291;
102: public const PLUS_297 = 297;
103: public const PLUS_298 = 298;
104: public const PLUS_299 = 299;
105: public const PLUS_30 = 30;
106: public const PLUS_31 = 31;
107: public const PLUS_32 = 32;
108: public const PLUS_33 = 33;
109: public const PLUS_34 = 34;
110: public const PLUS_350 = 350;
111: public const PLUS_351 = 351;
112: public const PLUS_352 = 352;
113: public const PLUS_353 = 353;
114: public const PLUS_354 = 354;
115: public const PLUS_355 = 355;
116: public const PLUS_356 = 356;
117: public const PLUS_357 = 357;
118: public const PLUS_358 = 358;
119: public const PLUS_359 = 359;
120: public const PLUS_36 = 36;
121: public const PLUS_370 = 370;
122: public const PLUS_371 = 371;
123: public const PLUS_372 = 372;
124: public const PLUS_373 = 373;
125: public const PLUS_374 = 374;
126: public const PLUS_375 = 375;
127: public const PLUS_376 = 376;
128: public const PLUS_377 = 377;
129: public const PLUS_378 = 378;
130: public const PLUS_380 = 380;
131: public const PLUS_381 = 381;
132: public const PLUS_382 = 382;
133: public const PLUS_383 = 383;
134: public const PLUS_385 = 385;
135: public const PLUS_386 = 386;
136: public const PLUS_387 = 387;
137: public const PLUS_388 = 388;
138: public const PLUS_389 = 389;
139: public const PLUS_39 = 39;
140: public const PLUS_40 = 40;
141: public const PLUS_41 = 41;
142: public const PLUS_420 = 420;
143: public const PLUS_421 = 421;
144: public const PLUS_423 = 423;
145: public const PLUS_43 = 43;
146: public const PLUS_44 = 44;
147: public const PLUS_45 = 45;
148: public const PLUS_46 = 46;
149: public const PLUS_47 = 47;
150: public const PLUS_48 = 48;
151: public const PLUS_49 = 49;
152: public const PLUS_500 = 500;
153: public const PLUS_501 = 501;
154: public const PLUS_502 = 502;
155: public const PLUS_503 = 503;
156: public const PLUS_504 = 504;
157: public const PLUS_505 = 505;
158: public const PLUS_506 = 506;
159: public const PLUS_507 = 507;
160: public const PLUS_508 = 508;
161: public const PLUS_509 = 509;
162: public const PLUS_51 = 51;
163: public const PLUS_52 = 52;
164: public const PLUS_53 = 53;
165: public const PLUS_54 = 54;
166: public const PLUS_55 = 55;
167: public const PLUS_56 = 56;
168: public const PLUS_57 = 57;
169: public const PLUS_58 = 58;
170: public const PLUS_590 = 590;
171: public const PLUS_591 = 591;
172: public const PLUS_592 = 592;
173: public const PLUS_593 = 593;
174: public const PLUS_594 = 594;
175: public const PLUS_595 = 595;
176: public const PLUS_596 = 596;
177: public const PLUS_597 = 597;
178: public const PLUS_598 = 598;
179: public const PLUS_60 = 60;
180: public const PLUS_61 = 61;
181: public const PLUS_62 = 62;
182: public const PLUS_63 = 63;
183: public const PLUS_64 = 64;
184: public const PLUS_65 = 65;
185: public const PLUS_66 = 66;
186: public const PLUS_670 = 670;
187: public const PLUS_672 = 672;
188: public const PLUS_673 = 673;
189: public const PLUS_674 = 674;
190: public const PLUS_675 = 675;
191: public const PLUS_676 = 676;
192: public const PLUS_677 = 677;
193: public const PLUS_678 = 678;
194: public const PLUS_679 = 679;
195: public const PLUS_680 = 680;
196: public const PLUS_681 = 681;
197: public const PLUS_682 = 682;
198: public const PLUS_683 = 683;
199: public const PLUS_685 = 685;
200: public const PLUS_686 = 686;
201: public const PLUS_687 = 687;
202: public const PLUS_688 = 688;
203: public const PLUS_689 = 689;
204: public const PLUS_690 = 690;
205: public const PLUS_691 = 691;
206: public const PLUS_692 = 692;
207: public const PLUS_7 = 7;
208: public const PLUS_81 = 81;
209: public const PLUS_82 = 82;
210: public const PLUS_84 = 84;
211: public const PLUS_850 = 850;
212: public const PLUS_852 = 852;
213: public const PLUS_853 = 853;
214: public const PLUS_855 = 855;
215: public const PLUS_856 = 856;
216: public const PLUS_86 = 86;
217: public const PLUS_880 = 880;
218: public const PLUS_886 = 886;
219: public const PLUS_90 = 90;
220: public const PLUS_91 = 91;
221: public const PLUS_92 = 92;
222: public const PLUS_93 = 93;
223: public const PLUS_94 = 94;
224: public const PLUS_95 = 95;
225: public const PLUS_960 = 960;
226: public const PLUS_961 = 961;
227: public const PLUS_962 = 962;
228: public const PLUS_963 = 963;
229: public const PLUS_964 = 964;
230: public const PLUS_965 = 965;
231: public const PLUS_966 = 966;
232: public const PLUS_967 = 967;
233: public const PLUS_968 = 968;
234: public const PLUS_970 = 970;
235: public const PLUS_971 = 971;
236: public const PLUS_972 = 972;
237: public const PLUS_973 = 973;
238: public const PLUS_974 = 974;
239: public const PLUS_975 = 975;
240: public const PLUS_976 = 976;
241: public const PLUS_977 = 977;
242: public const PLUS_98 = 98;
243: public const PLUS_992 = 992;
244: public const PLUS_993 = 993;
245: public const PLUS_994 = 994;
246: public const PLUS_995 = 995;
247: public const PLUS_996 = 996;
248: public const PLUS_998 = 998;
249:
250: /**
251: * https://en.wikipedia.org/wiki/List_of_country_calling_codes
252: * @var int[][]
253: */
254: private static $countries = [
255: self::PLUS_1 => [Country::UNITED_STATES, Country::CANADA],
256: self::PLUS_1242 => Country::BAHAMAS,
257: self::PLUS_1246 => Country::BARBADOS,
258: self::PLUS_1264 => Country::ANGUILLA,
259: self::PLUS_1268 => Country::ANTIGUA_AND_BARBUDA,
260: self::PLUS_1284 => Country::VIRGIN_ISLANDS_BRITISH,
261: self::PLUS_1340 => Country::VIRGIN_ISLANDS_US,
262: self::PLUS_1345 => Country::CAYMAN_ISLANDS,
263: self::PLUS_1441 => Country::BERMUDA,
264: self::PLUS_1473 => Country::GRENADA,
265: self::PLUS_1646 => Country::MONTSERRAT,
266: self::PLUS_1649 => Country::TURKS_AND_CAICOS_ISLANDS,
267: self::PLUS_1670 => Country::NORTHERN_MARIANA_ISLANDS,
268: self::PLUS_1671 => Country::GUAM,
269: self::PLUS_1684 => Country::AMERICAN_SAMOA,
270: self::PLUS_1721 => Country::SAINT_MARTIN_DUTCH,
271: self::PLUS_1758 => Country::SAINT_LUCIA,
272: self::PLUS_1767 => Country::DOMINICA,
273: self::PLUS_1784 => Country::SAINT_VINCENT_AND_THE_GRENADINES,
274: self::PLUS_1787 => Country::PUERTO_RICO,
275: self::PLUS_1809 => Country::DOMINICAN_REPUBLIC,
276: self::PLUS_1867 => Country::JAMAICA,
277: self::PLUS_1868 => Country::TRINIDAD_AND_TOBAGO,
278: self::PLUS_1869 => Country::SAINT_KITTS_AND_NEVIS,
279: self::PLUS_20 => Country::EGYPT,
280: self::PLUS_211 => Country::SOUTH_SUDAN,
281: self::PLUS_212 => Country::MOROCCO,
282: self::PLUS_213 => Country::ALGERIA,
283: self::PLUS_216 => Country::TUNISIA,
284: self::PLUS_218 => Country::LIBYA,
285: self::PLUS_220 => Country::GAMBIA,
286: self::PLUS_221 => Country::SENEGAL,
287: self::PLUS_222 => Country::MAURITANIA,
288: self::PLUS_223 => Country::MALI,
289: self::PLUS_224 => Country::GUINEA,
290: self::PLUS_225 => Country::COTE_D_IVOIRE,
291: self::PLUS_226 => Country::BURKINA_FASO,
292: self::PLUS_227 => Country::NIGER,
293: self::PLUS_228 => Country::TOGO,
294: self::PLUS_229 => Country::BENIN,
295: self::PLUS_230 => Country::MAURITIUS,
296: self::PLUS_231 => Country::LIBERIA,
297: self::PLUS_232 => Country::SIERRA_LEONE,
298: self::PLUS_233 => Country::GHANA,
299: self::PLUS_234 => Country::NIGERIA,
300: self::PLUS_235 => Country::CHAD,
301: self::PLUS_236 => Country::CENTRAL_AFRICAN_REPUBLIC,
302: self::PLUS_237 => Country::CAMEROON,
303: self::PLUS_238 => Country::CAPE_VERDE,
304: self::PLUS_239 => Country::SAO_TOME_AND_PRINCIPE,
305: self::PLUS_240 => Country::EQUATORIAL_GUINEA,
306: self::PLUS_241 => Country::GABON,
307: self::PLUS_242 => Country::CONGO,
308: self::PLUS_243 => Country::DEMOCRATIC_REPUBLIC_OF_THE_CONGO,
309: self::PLUS_244 => Country::ANGOLA,
310: self::PLUS_245 => Country::GUINEA_BISSAU,
311: self::PLUS_246 => Country::BRITISH_INDIAN_OCEAN_TERRITORY,
312: self::PLUS_248 => Country::SEYCHELLES,
313: self::PLUS_249 => Country::SUDAN,
314: self::PLUS_250 => Country::RWANDA,
315: self::PLUS_251 => Country::ETHIOPIA,
316: self::PLUS_252 => Country::SOMALIA,
317: self::PLUS_253 => Country::DJIBOUTI,
318: self::PLUS_254 => Country::KENYA,
319: self::PLUS_255 => Country::TANZANIA,
320: self::PLUS_256 => Country::UGANDA,
321: self::PLUS_257 => Country::BURUNDI,
322: self::PLUS_258 => Country::MOZAMBIQUE,
323: self::PLUS_260 => Country::ZAMBIA,
324: self::PLUS_261 => Country::MADAGASCAR,
325: self::PLUS_262 => [Country::REUNION, Country::FRENCH_SOUTHERN_TERRITORIES, Country::MAYOTTE],
326: self::PLUS_263 => Country::ZIMBABWE,
327: self::PLUS_264 => Country::NAMIBIA,
328: self::PLUS_265 => Country::MALAWI,
329: self::PLUS_266 => Country::LESOTHO,
330: self::PLUS_267 => Country::BOTSWANA,
331: self::PLUS_268 => Country::SWAZILAND,
332: self::PLUS_269 => Country::COMOROS,
333: self::PLUS_27 => Country::SOUTH_AFRICA,
334: self::PLUS_290 => Country::SAINT_HELENA,
335: self::PLUS_291 => Country::ERITREA,
336: self::PLUS_297 => Country::ARUBA,
337: self::PLUS_298 => Country::FAROE_ISLANDS,
338: self::PLUS_299 => Country::GREENLAND,
339: self::PLUS_30 => Country::GREECE,
340: self::PLUS_31 => Country::NETHERLANDS,
341: self::PLUS_32 => Country::BELGIUM,
342: self::PLUS_33 => Country::FRANCE,
343: self::PLUS_34 => Country::SPAIN,
344: self::PLUS_350 => Country::GIBRALTAR,
345: self::PLUS_351 => Country::PORTUGAL,
346: self::PLUS_352 => Country::LUXEMBOURG,
347: self::PLUS_353 => Country::IRELAND,
348: self::PLUS_354 => Country::ICELAND,
349: self::PLUS_355 => Country::ALBANIA,
350: self::PLUS_356 => Country::MALTA,
351: self::PLUS_357 => Country::CYPRUS,
352: self::PLUS_358 => [Country::FINLAND, Country::ALAND_ISLANDS],
353: self::PLUS_359 => Country::BULGARIA,
354: self::PLUS_36 => Country::HUNGARY,
355: self::PLUS_370 => Country::LITHUANIA,
356: self::PLUS_371 => Country::LATVIA,
357: self::PLUS_372 => Country::ESTONIA,
358: self::PLUS_373 => Country::MOLDOVA,
359: self::PLUS_374 => Country::ARMENIA,
360: self::PLUS_375 => Country::BELARUS,
361: self::PLUS_376 => Country::ANDORRA,
362: self::PLUS_377 => Country::MONACO,
363: self::PLUS_378 => Country::SAN_MARINO,
364: self::PLUS_380 => Country::UKRAINE,
365: self::PLUS_381 => Country::SERBIA,
366: self::PLUS_382 => Country::MONTENEGRO,
367: self::PLUS_383 => Country::KOSOVO,
368: self::PLUS_385 => Country::CROATIA,
369: self::PLUS_386 => Country::SLOVENIA,
370: self::PLUS_387 => Country::BOSNIA_AND_HERZEGOVINA,
371: self::PLUS_388 => Country::EU,
372: self::PLUS_389 => Country::MACEDONIA,
373: self::PLUS_39 => [Country::ITALY, Country::VATICAN],
374: self::PLUS_40 => Country::ROMANIA,
375: self::PLUS_41 => Country::SWITZERLAND,
376: self::PLUS_420 => Country::CZECHIA,
377: self::PLUS_421 => Country::SLOVAKIA,
378: self::PLUS_423 => Country::LIECHTENSTEIN,
379: self::PLUS_43 => Country::AUSTRIA,
380: self::PLUS_44 => [Country::UNITED_KINGDOM, Country::ISLE_OF_MAN, Country::GUERNSEY, Country::JERSEY],
381: self::PLUS_45 => Country::DENMARK,
382: self::PLUS_46 => Country::SWEDEN,
383: self::PLUS_47 => [Country::NORWAY, Country::SVALBARD_AND_JAN_MAYEN],
384: self::PLUS_48 => Country::POLAND,
385: self::PLUS_49 => Country::GERMANY,
386: self::PLUS_500 => [Country::FALKLAND_ISLANDS, Country::SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH],
387: self::PLUS_501 => Country::BELIZE,
388: self::PLUS_502 => Country::GUATEMALA,
389: self::PLUS_503 => Country::EL_SALVADOR,
390: self::PLUS_504 => Country::HONDURAS,
391: self::PLUS_505 => Country::NICARAGUA,
392: self::PLUS_506 => Country::COSTA_RICA,
393: self::PLUS_507 => Country::PANAMA,
394: self::PLUS_508 => Country::SAINT_PIERRE_AND_MIQUELON,
395: self::PLUS_509 => Country::HAITI,
396: self::PLUS_51 => Country::PERU,
397: self::PLUS_52 => Country::MEXICO,
398: self::PLUS_53 => Country::CUBA,
399: self::PLUS_54 => Country::ARGENTINA,
400: self::PLUS_55 => Country::BRAZIL,
401: self::PLUS_56 => Country::CHILE,
402: self::PLUS_57 => Country::COLOMBIA,
403: self::PLUS_58 => Country::VENEZUELA,
404: self::PLUS_590 => [Country::GUADELOUPE, Country::SAINT_MARTIN_FRENCH],
405: self::PLUS_591 => Country::BOLIVIA,
406: self::PLUS_592 => Country::GUYANA,
407: self::PLUS_593 => Country::ECUADOR,
408: self::PLUS_594 => Country::FRENCH_GUIANA,
409: self::PLUS_595 => Country::PARAGUAY,
410: self::PLUS_596 => Country::MARTINIQUE,
411: self::PLUS_597 => Country::SURINAME,
412: self::PLUS_598 => Country::URUGUAY,
413: self::PLUS_60 => Country::MALAYSIA,
414: self::PLUS_61 => [Country::AUSTRALIA, Country::CHRISTMAS_ISLAND, Country::COCOS_ISLANDS],
415: self::PLUS_62 => Country::INDONESIA,
416: self::PLUS_63 => Country::PHILIPPINES,
417: self::PLUS_64 => [Country::NEW_ZEALAND, Country::PITCAIRN],
418: self::PLUS_65 => Country::SINGAPORE,
419: self::PLUS_66 => Country::THAILAND,
420: self::PLUS_670 => Country::TIMOR_LESTE,
421: self::PLUS_672 => [Country::NORFOLK_ISLAND, Country::ANTARCTICA],
422: self::PLUS_673 => Country::BRUNEI_DARUSSALAM,
423: self::PLUS_674 => Country::NAURU,
424: self::PLUS_675 => Country::PAPUA_NEW_GUINEA,
425: self::PLUS_676 => Country::TONGA,
426: self::PLUS_677 => Country::SOLOMON_ISLANDS,
427: self::PLUS_678 => Country::VANUATU,
428: self::PLUS_679 => Country::FIJI,
429: self::PLUS_680 => Country::PALAU,
430: self::PLUS_681 => Country::WALLIS_AND_FUTUNA,
431: self::PLUS_682 => Country::COOK_ISLANDS,
432: self::PLUS_683 => Country::NIUE,
433: self::PLUS_685 => Country::SAMOA,
434: self::PLUS_686 => Country::KIRIBATI,
435: self::PLUS_687 => Country::NEW_CALEDONIA,
436: self::PLUS_688 => Country::TUVALU,
437: self::PLUS_689 => Country::FRENCH_POLYNESIA,
438: self::PLUS_690 => Country::TOKELAU,
439: self::PLUS_691 => Country::MICRONESIA,
440: self::PLUS_692 => Country::MARSHALL_ISLANDS,
441: self::PLUS_7 => [Country::RUSSIA, Country::KAZAKHSTAN],
442: self::PLUS_81 => Country::JAPAN,
443: self::PLUS_82 => Country::SOUTH_KOREA,
444: self::PLUS_84 => Country::VIETNAM,
445: self::PLUS_850 => Country::NORTH_KOREA,
446: self::PLUS_852 => Country::HONG_KONG,
447: self::PLUS_853 => Country::MACAO,
448: self::PLUS_855 => Country::CAMBODIA,
449: self::PLUS_856 => Country::LAOS,
450: self::PLUS_86 => Country::CHINA,
451: self::PLUS_880 => Country::BANGLADESH,
452: self::PLUS_886 => Country::TAIWAN,
453: self::PLUS_90 => Country::TURKEY,
454: self::PLUS_91 => Country::INDIA,
455: self::PLUS_92 => Country::PAKISTAN,
456: self::PLUS_93 => Country::AFGHANISTAN,
457: self::PLUS_94 => Country::SRI_LANKA,
458: self::PLUS_95 => Country::MYANMAR,
459: self::PLUS_960 => Country::MALDIVES,
460: self::PLUS_961 => Country::LEBANON,
461: self::PLUS_962 => Country::JORDAN,
462: self::PLUS_963 => Country::SYRIA,
463: self::PLUS_964 => Country::IRAQ,
464: self::PLUS_965 => Country::KUWAIT,
465: self::PLUS_966 => Country::SAUDI_ARABIA,
466: self::PLUS_967 => Country::YEMEN,
467: self::PLUS_968 => Country::OMAN,
468: self::PLUS_970 => Country::PALESTINE,
469: self::PLUS_971 => Country::UNITED_ARAB_EMIRATES,
470: self::PLUS_972 => Country::ISRAEL,
471: self::PLUS_973 => Country::BAHRAIN,
472: self::PLUS_974 => Country::QATAR,
473: self::PLUS_975 => Country::BHUTAN,
474: self::PLUS_976 => Country::MONGOLIA,
475: self::PLUS_977 => Country::NEPAL,
476: self::PLUS_98 => Country::ISLAMIC_REPUBLIC_OF_IRAN,
477: self::PLUS_992 => Country::TAJIKISTAN,
478: self::PLUS_993 => Country::TURKMENISTAN,
479: self::PLUS_994 => Country::AZERBAIJAN,
480: self::PLUS_995 => Country::GEORGIA,
481: self::PLUS_996 => Country::KYRGYZSTAN,
482: self::PLUS_998 => Country::UZBEKISTAN,
483: ];
484:
485: /**
486: * @return \Dogma\Country\Country[]
487: */
488: public function getCountries(): array
489: {
490: return array_map(function (string $countryCode) {
491: return Country::get($countryCode);
492: }, self::$countries[$this->getValue()]);
493: }
494:
495: public function getByCountry(Country $country): ?self
496: {
497: foreach (self::$countries as $prefix => $countries) {
498: if (Arr::contains($countries, $country->getValue())) {
499: return self::get($prefix);
500: }
501: }
502: return null;
503: }
504:
505: }
| 100 % | Reflection\exceptions\Exception.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Reflection;
11:
12: interface Exception
13: {
14:
15: }
| 100 % | Reflection\exceptions\InvalidMethodAnnotationException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Reflection;
11:
12: class InvalidMethodAnnotationException extends \Dogma\Exception implements \Dogma\Reflection\Exception
13: {
14:
15: /**
16: * @param string $method
17: * @param string $message
18: * @param \Exception $previous
19: */
20: public function __construct(\ReflectionMethod $method, string $message, ?\Exception $previous = null)
21: {
22: parent::__construct(sprintf(
23: 'Invalid method annotation on %s::%s: %s',
24: $method->getDeclaringClass()->getName(),
25: $method->getName(),
26: $message
27: ), $previous);
28: }
29:
30: }
| 100 % | Reflection\exceptions\UnprocessableParameterException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Reflection;
11:
12: class UnprocessableParameterException extends \Dogma\Exception implements \Dogma\Reflection\Exception
13: {
14:
15: /**
16: * @param string $method
17: * @param string $message
18: * @param \Exception $previous
19: */
20: public function __construct(\ReflectionMethod $method, string $message, ?\Exception $previous = null)
21: {
22: parent::__construct(sprintf(
23: 'Unprocessable parameter on %s::%s: %s',
24: $method->getDeclaringClass()->getName(),
25: $method->getName(),
26: $message
27: ), $previous);
28: }
29:
30: }
| 94 % | Reflection\MethodTypeParser.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Reflection;
11:
12: use Dogma\Type;
13: use ReflectionMethod;
14:
15: class MethodTypeParser implements \Dogma\NonIterable
16: {
17: use \Dogma\StrictBehaviorMixin;
18: use \Dogma\NonIterableMixin;
19:
20: /** @var string[] */
21: private $typeList;
22:
23: public function __construct()
24: {
25: $this->typeList = Type::listTypes();
26: }
27:
28: /**
29: * @param \ReflectionMethod $method
30: * @return \Dogma\Type[]
31: */
32: public function getTypes(ReflectionMethod $method): array
33: {
34: $raw = $this->getTypesRaw($method);
35:
36: $types = [];
37: foreach ($raw as $name => $options) {
38: $types[$name] = $this->createType($options, $method);
39: }
40:
41: return $types;
42: }
43:
44: /**
45: * @param \ReflectionMethod $method
46: * @return \Dogma\Type[]
47: */
48: public function getParameterTypes(ReflectionMethod $method): array
49: {
50: $raw = $this->getTypesRaw($method);
51:
52: $types = [];
53: foreach ($raw as $name => $options) {
54: if ($name === '@return') {
55: continue;
56: }
57: $types[$name] = $this->createType($options, $method);
58: }
59:
60: return $types;
61: }
62:
63: /**
64: * @param mixed[] $options
65: * @param \ReflectionMethod $method
66: * @return \Dogma\Type
67: */
68: private function createType(array $options, ReflectionMethod $method): Type
69: {
70: if (!empty($options['reference']) || !empty($options['variadic'])) {
71: throw new \Dogma\Reflection\UnprocessableParameterException($method, 'Variadic and by reference parameters are not supported.');
72: }
73: $itemTypes = [];
74: $containerTypes = [];
75: $otherTypes = [];
76: foreach ($options['types'] as $type) {
77: $typeParts = explode('[', $type);
78: $count = count($typeParts);
79: if ($count > 2) {
80: throw new \Dogma\Reflection\UnprocessableParameterException($method, 'Multidimensional arrays are not supported.');
81: } elseif ($count === 2) {
82: $itemTypes[] = $typeParts[0];
83: } elseif ($type === Type::PHP_ARRAY || is_subclass_of($type, \Traversable::class)) {
84: $containerTypes[] = $type;
85: } elseif (strstr($type, '(')) {
86: $typeBase = explode('(', $type)[0];
87: if (in_array($typeBase, $otherTypes)) {
88: unset($otherTypes[array_search($typeBase, $otherTypes)]);
89: }
90: $otherTypes[] = $type;
91: } else {
92: $add = true;
93: foreach ($otherTypes as $otherType) {
94: $otherTypeBase = explode('(', $otherType)[0];
95: if ($otherTypeBase === $type) {
96: $add = false;
97: break;
98: }
99: }
100: if ($add) {
101: $otherTypes[] = $type;
102: }
103: }
104: }
105: $otherTypes = array_values($otherTypes);
106: if ($itemTypes && !$containerTypes) {
107: $containerTypes[] = Type::PHP_ARRAY;
108: } elseif ($containerTypes && !$itemTypes) {
109: $itemTypes[] = Type::MIXED;
110: }
111: if (($containerTypes && $otherTypes) || count($containerTypes) > 1 || count($otherTypes) > 1 || count($itemTypes) > 1) {
112: throw new \Dogma\Reflection\InvalidMethodAnnotationException($method, 'Invalid combination of types.');
113: } elseif ($itemTypes) {
114: return Type::collectionOf($containerTypes[0], $itemTypes[0], $options['nullable']);
115: } elseif ($otherTypes) {
116: return Type::get($otherTypes[0], $options['nullable']);
117: } else {
118: return Type::get(Type::MIXED, $options['nullable']);
119: }
120: }
121:
122: /**
123: * @param \ReflectionMethod $method
124: * @return mixed[] ($name => ($types, $nullable, $reference, $variadic, $optional))
125: */
126: public function getTypesRaw(ReflectionMethod $method): array
127: {
128: $items = [];
129: $paramRefs = $method->getParameters();
130: foreach ($paramRefs as $paramRef) {
131: if ($paramRef->isArray()) {
132: $types = [Type::PHP_ARRAY];
133: } elseif ($paramRef->isCallable()) {
134: $types = [Type::PHP_CALLABLE];
135: } elseif ($paramRef->getClass()) {
136: $types = [$paramRef->getClass()->getName()];
137: } elseif ($paramRef->hasType()) {
138: $types = [(string) $paramRef->getType()];
139: } else {
140: $types = [];
141: }
142:
143: $nullable = $paramRef->isDefaultValueAvailable() && $paramRef->getDefaultValue() === null;
144:
145: $items[$paramRef->getName()] = [
146: 'types' => $types,
147: 'nullable' => $nullable,
148: 'reference' => $paramRef->isPassedByReference(),
149: 'variadic' => $paramRef->isVariadic(),
150: 'optional' => $paramRef->isOptional(),
151: ];
152: }
153:
154: $docComment = $method->getDocComment();
155: if (!empty($docComment)) {
156: $comments = $this->parseDocComment($docComment, $method);
157: if (count($items) !== count($comments) - (isset($comments['@return']) ? 1 : 0)) {
158: throw new \Dogma\Reflection\InvalidMethodAnnotationException($method, '@param annotations count does not match with parameters count');
159: }
160:
161: $names = array_keys($items);
162: foreach ($comments as $i => $comment) {
163: if ($i === '@return') {
164: $items[$i] = $comment;
165: continue;
166: }
167: $item = &$items[$names[$i]];
168: if ($comment['name'] !== null && $comment['name'] !== $names[$i]) {
169: throw new \Dogma\Reflection\InvalidMethodAnnotationException($method, 'Parameter names in annotation and in declaration does not match.');
170: }
171: $item['nullable'] = $item['nullable'] || $comment['nullable'];
172: $item['variadic'] = $item['variadic'] || $comment['variadic'];
173: $item['types'] = array_unique(array_merge($item['types'], $comment['types']));
174: }
175: }
176:
177: return $items;
178: }
179:
180: /**
181: * @param string $docComment
182: * @param \ReflectionMethod $method
183: * @return mixed[]
184: */
185: public function parseDocComment(string $docComment, ReflectionMethod $method): array
186: {
187: $docComment = trim(trim(trim($docComment, '/'), '*'));
188: $items = [];
189: foreach (explode("\n", $docComment) as $row) {
190: if (strstr($row, '@param')) {
191: if (!preg_match('/@param\\s+(&|[.]{3})?\\s*((?:\\\\?[^\\s\\[\\]\\|]+(?:\\[\\])*\\|?)+)\s*(&|[.]{3})?(?:\\s*\\$([^\\s]+))?/u', $row, $matches)) {
192: throw new \Dogma\Reflection\InvalidMethodAnnotationException($method, 'invalid @param annotation format at: ' . $row);
193: }
194: @list(, $mod1, $types, $mod2, $name) = $matches;
195: $variadic = $mod1 === '...' || $mod2 === '...';
196: $types = explode('|', $types);
197: $nullable = false;
198: foreach ($types as $i => $type) {
199: if (strtolower($type) === Type::NULL) {
200: unset($types[$i]);
201: $nullable = true;
202: continue;
203: }
204: $types[$i] = $this->checkType($type, $method);
205: }
206:
207: $items[] = [
208: 'name' => $name,
209: 'types' => $types,
210: 'nullable' => $nullable,
211: 'reference' => false,
212: 'variadic' => $variadic, // may be simulated by func_get_args()
213: ];
214:
215: } elseif (strstr($row, '@return')) {
216: if (!preg_match('/@return\\s+([^\\s]+)/u', $row, $matches)) {
217: throw new \Dogma\Reflection\InvalidMethodAnnotationException($method, 'invalid @param annotation format at: ' . $row);
218: }
219: $types = explode('|', $matches[1]);
220: $nullable = false;
221: foreach ($types as $i => $type) {
222: if (strtolower($type) === Type::NULL) {
223: unset($types[$i]);
224: $nullable = true;
225: continue;
226: }
227: $types[$i] = $this->checkType($type, $method);
228: }
229: $items['@return'] = [
230: 'types' => $types,
231: 'nullable' => $nullable,
232: ];
233: }
234: }
235:
236: return $items;
237: }
238:
239: private function checkType(string $typeString, ReflectionMethod $method): string
240: {
241: if ($typeString === 'self' || $typeString === 'static') {
242: return $method->getDeclaringClass()->getName();
243: }
244:
245: $typeString = preg_replace('/\\(([0-9]+)u\\)/', '(\\1,unsigned)', $typeString);
246:
247: $trimmed = rtrim(ltrim($typeString, '\\'), '[]');
248:
249: $type = Type::fromId($trimmed);
250: if ($type->isClass()) {
251: if ($typeString[0] !== '\\') {
252: throw new \Dogma\Reflection\InvalidMethodAnnotationException($method, 'Always use fully qualified names in type annotations.');
253: } elseif (!class_exists($type->getName())) {
254: throw new \Dogma\Reflection\InvalidMethodAnnotationException($method, sprintf('Unknown class %s. Make sure that you use fully qualified class names.', $typeString));
255: }
256: } else {
257: if ($typeString[0] === '\\') {
258: throw new \Dogma\Reflection\InvalidMethodAnnotationException($method, 'Cannot prefix scalar type with backslash.');
259: }
260: }
261: return ltrim($typeString, '\\');
262: }
263:
264: }
| 0 % | System\Environment.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\System;
11:
12: class Environment
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public static function isWindows(): bool
17: {
18: return strstr(strtolower(PHP_OS), 'win') !== false;
19: }
20:
21: }
| 0 % | System\Error\Error.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\System\Error;
11:
12: interface Error
13: {
14:
15: /**
16: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint
17: * @return int
18: */
19: public function getValue(); // compatible with Enum
20:
21: public function getDescription(): string;
22:
23: }
| 0 % | System\Error\ErrorHelper.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\System\Error;
11:
12: class ErrorHelper
13: {
14:
15: public const LOCAL = 0;
16: public const LINUX = 1;
17: public const UNIX = 2;
18: public const WINDOWS = 3;
19:
20: /**
21: * Get error object for given error number.
22: * @param int $errno
23: * @param int|string $system
24: * @return \Dogma\System\Error\Error|null
25: */
26: public static function getError(int $errno, $system = self::LOCAL): ?Error
27: {
28: if (!$system || !is_int($system)) {
29: $system = self::detectSystem($system);
30: }
31: if (!$system) {
32: return null;
33: }
34:
35: try {
36: switch ($system) {
37: case self::LINUX:
38: return LinuxError::get($errno);
39: case self::UNIX:
40: return UnixError::get($errno);
41: case self::WINDOWS:
42: return WindowsError::get($errno);
43: }
44: } catch (\Throwable $e) {
45: return null;
46: }
47:
48: return null;
49: }
50:
51: /**
52: * Get error message for given error number.
53: * @param int $errno
54: * @param int|string $system
55: * @return string|null
56: */
57: public static function getErrorDescription(int $errno, $system = self::LOCAL): ?string
58: {
59: $error = self::getError($errno, $system);
60: if ($error !== null) {
61: return $error->getDescription();
62: }
63:
64: return null;
65: }
66:
67: public static function detectSystem(?string $string = null): ?int
68: {
69: if (!$string) {
70: $string = PHP_OS;
71: }
72: $string = strtolower($string);
73:
74: if (strpos($string, 'linux') !== false) {
75: return self::LINUX;
76: } elseif (strpos($string, 'win') !== false) {
77: return self::WINDOWS;
78: } elseif (strpos($string, 'mac') !== false) {
79: return self::UNIX;
80: } elseif (strpos($string, 'bsd') !== false) {
81: return self::UNIX;
82: } elseif (strpos($string, 'unix') !== false) {
83: return self::UNIX;
84: }
85:
86: return null;
87: }
88:
89: }
| 0 % | System\Error\LinuxError.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: // spell-check-ignore: CSI SRMOUNT MULTIHOP RFS csi rfs
11:
12: namespace Dogma\System\Error;
13:
14: /**
15: * Linux system errors
16: */
17: class LinuxError extends \Dogma\Enum\IntEnum implements \Dogma\System\Error\Error
18: {
19:
20: // common with Unix:
21: public const SUCCESS = UnixError::SUCCESS;
22: public const OPERATION_NOT_PERMITTED = UnixError::OPERATION_NOT_PERMITTED;
23: public const NO_SUCH_FILE_OR_DIRECTORY = UnixError::NO_SUCH_FILE_OR_DIRECTORY;
24: public const NO_SUCH_PROCESS = UnixError::NO_SUCH_PROCESS;
25: public const INTERRUPTED_SYSTEM_CALL = UnixError::INTERRUPTED_SYSTEM_CALL;
26: public const IO_ERROR = UnixError::IO_ERROR;
27: public const NO_SUCH_DEVICE_OR_ADDRESS = UnixError::NO_SUCH_DEVICE_OR_ADDRESS;
28: public const ARGUMENT_LIST_TOO_LONG = UnixError::ARGUMENT_LIST_TOO_LONG;
29: public const EXEC_FORMAT_ERROR = UnixError::EXEC_FORMAT_ERROR;
30: public const BAD_FILE_NUMBER = UnixError::BAD_FILE_NUMBER;
31: public const NO_CHILD_PROCESSES = UnixError::NO_CHILD_PROCESSES;
32: public const TRY_AGAIN = UnixError::TRY_AGAIN;
33: public const OUT_OF_MEMORY = UnixError::OUT_OF_MEMORY;
34: public const PERMISSION_DENIED = UnixError::PERMISSION_DENIED;
35: public const BAD_ADDRESS = UnixError::BAD_ADDRESS;
36: public const BLOCK_DEVICE_REQUIRED = UnixError::BLOCK_DEVICE_REQUIRED;
37: public const DEVICE_OR_RESOURCE_BUSY = UnixError::DEVICE_OR_RESOURCE_BUSY;
38: public const FILE_EXISTS = UnixError::FILE_EXISTS;
39: public const CROSS_DEVICE_LINK = UnixError::CROSS_DEVICE_LINK;
40: public const NO_SUCH_DEVICE = UnixError::NO_SUCH_DEVICE;
41: public const NOT_A_DIRECTORY = UnixError::NOT_A_DIRECTORY;
42: public const IS_A_DIRECTORY = UnixError::IS_A_DIRECTORY;
43: public const INVALID_ARGUMENT = UnixError::INVALID_ARGUMENT;
44: public const FILE_TABLE_OVERFLOW = UnixError::FILE_TABLE_OVERFLOW;
45: public const TOO_MANY_OPEN_FILES = UnixError::TOO_MANY_OPEN_FILES;
46: public const NOT_A_TYPEWRITER = UnixError::NOT_A_TYPEWRITER;
47: public const TEXT_FILE_BUSY = UnixError::TEXT_FILE_BUSY;
48: public const FILE_TOO_LARGE = UnixError::FILE_TOO_LARGE;
49: public const NO_SPACE_LEFT_ON_DEVICE = UnixError::NO_SPACE_LEFT_ON_DEVICE;
50: public const ILLEGAL_SEEK = UnixError::ILLEGAL_SEEK;
51: public const READONLY_FILE_SYSTEM = UnixError::READONLY_FILE_SYSTEM;
52: public const TOO_MANY_LINKS = UnixError::TOO_MANY_LINKS;
53: public const BROKEN_PIPE = UnixError::BROKEN_PIPE;
54: public const NUMERICAL_ARGUMENT_OUT_OF_DOMAIN = UnixError::NUMERICAL_ARGUMENT_OUT_OF_DOMAIN;
55: public const RESULT_TOO_LARGE = UnixError::RESULT_TOO_LARGE;
56: public const RESOURCE_TEMPORARILY_UNAVAILABLE = UnixError::RESOURCE_TEMPORARILY_UNAVAILABLE;
57:
58: // differs from Unix;
59: public const FILE_NAME_TOO_LONG = 36;
60: public const NO_RECORD_LOCKS_AVAILABLE = 37;
61: public const FUNCTION_NOT_IMPLEMENTED = 38;
62: public const DIRECTORY_NOT_EMPTY = 39;
63: public const TOO_MANY_SYMBOLIC_LINKS_ENCOUNTERED = 40;
64: public const NO_MESSAGE_OF_DESIRED_TYPE = 42;
65: public const IDENTIFIER_REMOVED = 43;
66: public const CHANNEL_NUMBER_OUT_OF_RANGE = 44;
67: public const LEVEL_2_NOT_SYNCHRONIZED = 45;
68: public const LEVEL_3_HALTED = 46;
69: public const LEVEL_3_RESET = 47;
70: public const LINK_NUMBER_OUT_OF_RANGE = 48;
71: public const PROTOCOL_DRIVER_NOT_ATTACHED = 49;
72: public const NO_CSI_STRUCTURE_AVAILABLE = 50;
73: public const LEVEL_2_HALTED = 51;
74: public const INVALID_EXCHANGE = 52;
75: public const INVALID_REQUEST_DESCRIPTOR = 53;
76: public const EXCHANGE_FULL = 54;
77: public const NO_ANODE = 55;
78: public const INVALID_REQUEST_CODE = 56;
79: public const INVALID_SLOT = 57;
80: public const BAD_FONT_FILE_FORMAT = 59;
81: public const DEVICE_NOT_A_STREAM = 60;
82: public const NO_DATA_AVAILABLE = 61;
83: public const TIMER_EXPIRED = 62;
84: public const OUT_OF_STREAMS_RESOURCES = 63;
85: public const MACHINE_IS_NOT_ON_THE_NETWORK = 64;
86: public const PACKAGE_NOT_INSTALLED = 65;
87: public const OBJECT_IS_REMOTE = 66;
88: public const LINK_HAS_BEEN_SEVERED = 67;
89: public const ADVERTISE_ERROR = 68;
90: public const SRMOUNT_ERROR = 69;
91: public const COMMUNICATION_ERROR_ON_SEND = 70;
92: public const PROTOCOL_ERROR = 71;
93: public const MULTIHOP_ATTEMPTED = 72;
94: public const RFS_SPECIFIC_ERROR = 73;
95: public const NOT_A_DATA_MESSAGE = 74;
96: public const VALUE_TOO_LARGE_FOR_DEFINED_DATA_TYPE = 75;
97: public const NAME_NOT_UNIQUE_ON_NETWORK = 76;
98: public const FILE_DESCRIPTOR_IN_BAD_STATE = 77;
99: public const REMOTE_ADDRESS_CHANGED = 78;
100: public const CAN_NOT_ACCESS_A_NEEDED_SHARED_LIBRARY = 79;
101: public const ACCESSING_A_CORRUPTED_SHARED_LIBRARY = 80;
102: public const DOT_LIB_SECTION_IN_A_OUT_CORRUPTED = 81;
103: public const ATTEMPTING_TO_LINK_IN_TOO_MANY_SHARED_LIBRARIES = 82;
104: public const CANNOT_EXEC_A_SHARED_LIBRARY_DIRECTLY = 83;
105: public const ILLEGAL_BYTE_SEQUENCE = 84;
106: public const INTERRUPTED_SYSTEM_CALL_SHOULD_BE_RESTARTED = 85;
107: public const STREAMS_PIPE_ERROR = 86;
108: public const TOO_MANY_USERS = 87;
109: public const SOCKET_OPERATION_ON_NON_SOCKET = 88;
110: public const DESTINATION_ADDRESS_REQUIRED = 89;
111: public const MESSAGE_TOO_LONG = 90;
112: public const PROTOCOL_WRONG_TYPE_FOR_SOCKET = 91;
113: public const PROTOCOL_NOT_AVAILABLE = 92;
114: public const PROTOCOL_NOT_SUPPORTED = 93;
115: public const SOCKET_TYPE_NOT_SUPPORTED = 94;
116: public const OPERATION_NOT_SUPPORTED_ON_TRANSPORT_ENDPOINT = 95;
117: public const PROTOCOL_FAMILY_NOT_SUPPORTED = 96;
118: public const ADDRESS_FAMILY_NOT_SUPPORTED_BY_PROTOCOL = 97;
119: public const ADDRESS_ALREADY_IN_USE = 98;
120: public const CANNOT_ASSIGN_REQUESTED_ADDRESS = 99;
121: public const NETWORK_IS_DOWN = 100;
122: public const NETWORK_IS_UNREACHABLE = 101;
123: public const NETWORK_DROPPED_CONNECTION_BECAUSE_OF_RESET = 102;
124: public const SOFTWARE_CAUSED_CONNECTION_ABORT = 103;
125: public const CONNECTION_RESET_BY_PEER = 104;
126: public const NO_BUFFER_SPACE_AVAILABLE = 105;
127: public const TRANSPORT_ENDPOINT_IS_ALREADY_CONNECTED = 106;
128: public const TRANSPORT_ENDPOINT_IS_NOT_CONNECTED = 107;
129: public const CANNOT_SEND_AFTER_TRANSPORT_ENDPOINT_SHUTDOWN = 108;
130: public const TOO_MANY_REFERENCES_CANNOT_SPLICE = 109;
131: public const CONNECTION_TIMED_OUT = 110;
132: public const CONNECTION_REFUSED = 111;
133: public const HOST_IS_DOWN = 112;
134: public const NO_ROUTE_TO_HOST = 113;
135: public const OPERATION_ALREADY_IN_PROGRESS = 114;
136: public const OPERATION_NOW_IN_PROGRESS = 115;
137: public const STALE_NFS_FILE_HANDLE = 116;
138: public const STRUCTURE_NEEDS_CLEANING = 117;
139: public const NOT_A_XENIX_NAMED_TYPE_FILE = 118;
140: public const NO_XENIX_SEMAPHORES_AVAILABLE = 119;
141: public const IS_A_NAMED_TYPE_FILE = 120;
142: public const REMOTE_IO_ERROR = 121;
143: public const QUOTA_EXCEEDED = 122;
144: public const NO_MEDIUM_FOUND = 123;
145: public const WRONG_MEDIUM_TYPE = 124;
146: public const OPERATION_CANCELED = 125;
147: public const REQUIRED_KEY_NOT_AVAILABLE = 126;
148: public const KEY_HAS_EXPIRED = 127;
149: public const KEY_HAS_BEEN_REVOKED = 128;
150: public const KEY_WAS_REJECTED_BY_SERVICE = 129;
151: public const OWNER_DIED = 130;
152: public const STATE_NOT_RECOVERABLE = 131;
153:
154: public function getDescription(): string
155: {
156: return ucfirst(str_replace(
157: ['dot_lib', 'a_out', 'io', 'cross_device', 'readonly', 'non_socket', 'references', 'csi', 'rfs', 'nfs', 'xenix', '_'],
158: ['.lib', 'a.out', 'I/O', 'cross-device', 'read-only', 'non-socket', 'references:', 'CSI', 'RFS', 'NFS', 'XENIX', ' '],
159: strtolower($this->getConstantName())
160: ));
161: }
162:
163: }
| 0 % | System\Error\UnixError.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: // spell-check-ignore: PROG prog MULTIHOP
11:
12: namespace Dogma\System\Error;
13:
14: /**
15: * UNIX system errors (from FreeBSD)
16: */
17: class UnixError extends \Dogma\Enum\IntEnum implements \Dogma\System\Error\Error
18: {
19:
20: // common with Linux:
21: public const SUCCESS = 0;
22: public const OPERATION_NOT_PERMITTED = 1;
23: public const NO_SUCH_FILE_OR_DIRECTORY = 2;
24: public const NO_SUCH_PROCESS = 3;
25: public const INTERRUPTED_SYSTEM_CALL = 4;
26: public const IO_ERROR = 5;
27: public const NO_SUCH_DEVICE_OR_ADDRESS = 6;
28: public const ARGUMENT_LIST_TOO_LONG = 7;
29: public const EXEC_FORMAT_ERROR = 8;
30: public const BAD_FILE_NUMBER = 9;
31: public const NO_CHILD_PROCESSES = 10;
32: public const TRY_AGAIN = 11;
33: public const OUT_OF_MEMORY = 12;
34: public const PERMISSION_DENIED = 13;
35: public const BAD_ADDRESS = 14;
36: public const BLOCK_DEVICE_REQUIRED = 15;
37: public const DEVICE_OR_RESOURCE_BUSY = 16;
38: public const FILE_EXISTS = 17;
39: public const CROSS_DEVICE_LINK = 18;
40: public const NO_SUCH_DEVICE = 19;
41: public const NOT_A_DIRECTORY = 20;
42: public const IS_A_DIRECTORY = 21;
43: public const INVALID_ARGUMENT = 22;
44: public const FILE_TABLE_OVERFLOW = 23;
45: public const TOO_MANY_OPEN_FILES = 24;
46: public const NOT_A_TYPEWRITER = 25;
47: public const TEXT_FILE_BUSY = 26;
48: public const FILE_TOO_LARGE = 27;
49: public const NO_SPACE_LEFT_ON_DEVICE = 28;
50: public const ILLEGAL_SEEK = 29;
51: public const READONLY_FILE_SYSTEM = 30;
52: public const TOO_MANY_LINKS = 31;
53: public const BROKEN_PIPE = 32;
54: public const NUMERICAL_ARGUMENT_OUT_OF_DOMAIN = 33;
55: public const RESULT_TOO_LARGE = 34;
56: public const RESOURCE_TEMPORARILY_UNAVAILABLE = 35;
57:
58: // differs from Linux;
59: public const OPERATION_NOW_IN_PROGRESS = 36;
60: public const OPERATION_ALREADY_IN_PROGRESS = 37;
61: public const SOCKET_OPERATION_ON_NON_SOCKET = 38;
62: public const DESTINATION_ADDRESS_REQUIRED = 39;
63: public const MESSAGE_TOO_LONG = 40;
64: public const PROTOCOL_WRONG_TYPE_FOR_SOCKET = 41;
65: public const PROTOCOL_NOT_AVAILABLE = 42;
66: public const PROTOCOL_NOT_SUPPORTED = 43;
67: public const SOCKET_TYPE_NOT_SUPPORTED = 44;
68: public const OPERATION_NOT_SUPPORTED = 45;
69: public const PROTOCOL_FAMILY_NOT_SUPPORTED = 46;
70: public const ADDRESS_FAMILY_NOT_SUPPORTED_BY_PROTOCOL_FAMILY = 47;
71: public const ADDRESS_ALREADY_IN_USE = 48;
72: public const CANT_ASSIGN_REQUESTED_ADDRESS = 49;
73: public const NETWORK_IS_DOWN = 50;
74: public const NETWORK_IS_UNREACHABLE = 51;
75: public const NETWORK_DROPPED_CONNECTION_ON_RESET = 52;
76: public const SOFTWARE_CAUSED_CONNECTION_ABORT = 53;
77: public const CONNECTION_RESET_BY_PEER = 54;
78: public const NO_BUFFER_SPACE_AVAILABLE = 55;
79: public const SOCKET_IS_ALREADY_CONNECTED = 56;
80: public const SOCKET_IS_NOT_CONNECTED = 57;
81: public const CANT_SEND_AFTER_SOCKET_SHUTDOWN = 58;
82: public const TOO_MANY_REFERENCES_CANT_SPLICE = 59;
83: public const OPERATION_TIMED_OUT = 60;
84: public const CONNECTION_REFUSED = 61;
85: public const TOO_MANY_LEVELS_OF_SYMBOLIC_LINKS = 62;
86: public const FILE_NAME_TOO_LONG = 63;
87: public const HOST_IS_DOWN = 64;
88: public const NO_ROUTE_TO_HOST = 65;
89: public const DIRECTORY_NOT_EMPTY = 66;
90: public const TOO_MANY_PROCESSES = 67;
91: public const TOO_MANY_USERS = 68;
92: public const DISC_QUOTA_EXCEEDED = 69;
93: public const STALE_NFS_FILE_HANDLE = 70;
94: public const TOO_MANY_LEVELS_OF_REMOTE_IN_PATH = 71;
95: public const RPC_STRUCT_IS_BAD = 72;
96: public const RPC_VERSION_WRONG = 73;
97: public const RPC_PROG_NOT_AVAIL = 74;
98: public const PROGRAM_VERSION_WRONG = 75;
99: public const BAD_PROCEDURE_FOR_PROGRAM = 76;
100: public const NO_LOCKS_AVAILABLE = 77;
101: public const FUNCTION_NOT_IMPLEMENTED = 78;
102: public const INAPPROPRIATE_FILE_TYPE_OR_FORMAT = 79;
103: public const AUTHENTICATION_ERROR = 80;
104: public const NEED_AUTHENTICATOR = 81;
105: public const IDENTIFIER_REMOVED = 82;
106: public const NO_MESSAGE_OF_DESIRED_TYPE = 83;
107: public const VALUE_TOO_LARGE_TO_BE_STORED_IN_DATA_TYPE = 84;
108: public const OPERATION_CANCELED = 85;
109: public const ILLEGAL_BYTE_SEQUENCE = 86;
110: public const ATTRIBUTE_NOT_FOUND = 87;
111: public const PROGRAMMING_ERROR = 88;
112: public const BAD_MESSAGE = 89;
113: public const MULTIHOP_ATTEMPTED = 90;
114: public const LINK_HAS_BEEN_SEVERED = 91;
115: public const PROTOCOL_ERROR = 92;
116: public const CAPABILITIES_INSUFFICIENT = 93;
117: public const NOT_PERMITTED_IN_CAPABILITY_MODE = 94;
118: public const MUST_BE_EQUAL_LARGEST_ERRNO = 94;
119:
120: public function getDescription(): string
121: {
122: return ucfirst(str_replace(
123: ['non_socket', 'cant', 'references', 'rpc', 'nfs', 'prog_', '_'],
124: ['non-socket', 'can\'t', 'references:', 'RPC', 'NFS', 'prog. ', ' '],
125: strtolower($this->getConstantName())
126: ));
127: }
128:
129: }
| 0 % | System\Error\WindowsError.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\System\Error;
11:
12: /**
13: * Windows system errors (@see http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx)
14: */
15: class WindowsError extends \Dogma\Enum\IntEnum implements \Dogma\System\Error\Error
16: {
17:
18: public const ERROR_SUCCESS = 0;
19: public const ERROR_INVALID_FUNCTION = 1;
20: public const ERROR_FILE_NOT_FOUND = 2;
21: public const ERROR_PATH_NOT_FOUND = 3;
22: public const ERROR_TOO_MANY_OPEN_FILES = 4;
23: public const ERROR_ACCESS_DENIED = 5;
24: public const ERROR_INVALID_HANDLE = 6;
25: public const ERROR_ARENA_TRASHED = 7;
26: public const ERROR_NOT_ENOUGH_MEMORY = 8;
27: public const ERROR_INVALID_BLOCK = 9;
28: public const ERROR_BAD_ENVIRONMENT = 10;
29: public const ERROR_BAD_FORMAT = 11;
30: public const ERROR_INVALID_ACCESS = 12;
31: public const ERROR_INVALID_DATA = 13;
32: public const ERROR_OUT_OF_MEMORY = 14;
33: public const ERROR_INVALID_DRIVE = 15;
34: public const ERROR_CURRENT_DIRECTORY = 16;
35: public const ERROR_NOT_SAME_DEVICE = 17;
36: public const ERROR_NO_MORE_FILES = 18;
37: public const ERROR_WRITE_PROTECT = 19;
38: public const ERROR_BAD_UNIT = 20;
39: public const ERROR_NOT_READY = 21;
40: public const ERROR_BAD_COMMAND = 22;
41: public const ERROR_CRC = 23;
42: public const ERROR_BAD_LENGTH = 24;
43: public const ERROR_SEEK = 25;
44: public const ERROR_NOT_DOS_DISK = 26;
45: public const ERROR_SECTOR_NOT_FOUND = 27;
46: public const ERROR_OUT_OF_PAPER = 28;
47: public const ERROR_WRITE_FAULT = 29;
48: public const ERROR_READ_FAULT = 30;
49: public const ERROR_GEN_FAILURE = 31;
50: public const ERROR_SHARING_VIOLATION = 32;
51: public const ERROR_LOCK_VIOLATION = 33;
52: public const ERROR_WRONG_DISK = 34;
53: public const ERROR_SHARING_BUFFER_EXCEEDED = 36;
54: public const ERROR_HANDLE_EOF = 38;
55: public const ERROR_HANDLE_DISK_FULL = 39;
56: public const ERROR_NOT_SUPPORTED = 50;
57: public const ERROR_REM_NOT_LIST = 51;
58: public const ERROR_DUP_NAME = 52;
59: public const ERROR_BAD_NETPATH = 53;
60: public const ERROR_NETWORK_BUSY = 54;
61: public const ERROR_DEV_NOT_EXIST = 55;
62: public const ERROR_TOO_MANY_CMDS = 56;
63: public const ERROR_ADAP_HDW_ERR = 57;
64: public const ERROR_BAD_NET_RESP = 58;
65: public const ERROR_UNEXP_NET_ERR = 59;
66: public const ERROR_BAD_REM_ADAP = 60;
67: public const ERROR_PRINTQ_FULL = 61;
68: public const ERROR_NO_SPOOL_SPACE = 62;
69: public const ERROR_PRINT_CANCELLED = 63;
70: public const ERROR_NETNAME_DELETED = 64;
71: public const ERROR_NETWORK_ACCESS_DENIED = 65;
72: public const ERROR_BAD_DEV_TYPE = 66;
73: public const ERROR_BAD_NET_NAME = 67;
74: public const ERROR_TOO_MANY_NAMES = 68;
75: public const ERROR_TOO_MANY_SESS = 69;
76: public const ERROR_SHARING_PAUSED = 70;
77: public const ERROR_REQ_NOT_ACCEP = 71;
78: public const ERROR_REDIR_PAUSED = 72;
79: public const ERROR_FILE_EXISTS = 80;
80: public const ERROR_CANNOT_MAKE = 82;
81: public const ERROR_FAIL_I24 = 83;
82: public const ERROR_OUT_OF_STRUCTURES = 84;
83: public const ERROR_ALREADY_ASSIGNED = 85;
84: public const ERROR_INVALID_PASSWORD = 86;
85: public const ERROR_INVALID_PARAMETER = 87;
86: public const ERROR_NET_WRITE_FAULT = 88;
87: public const ERROR_NO_PROC_SLOTS = 89;
88: public const ERROR_TOO_MANY_SEMAPHORES = 100;
89: public const ERROR_EXCL_SEM_ALREADY_OWNED = 101;
90: public const ERROR_SEM_IS_SET = 102;
91: public const ERROR_TOO_MANY_SEM_REQUESTS = 103;
92: public const ERROR_INVALID_AT_INTERRUPT_TIME = 104;
93: public const ERROR_SEM_OWNER_DIED = 105;
94: public const ERROR_SEM_USER_LIMIT = 106;
95: public const ERROR_DISK_CHANGE = 107;
96: public const ERROR_DRIVE_LOCKED = 108;
97: public const ERROR_BROKEN_PIPE = 109;
98: public const ERROR_OPEN_FAILED = 110;
99: public const ERROR_BUFFER_OVERFLOW = 111;
100: public const ERROR_DISK_FULL = 112;
101: public const ERROR_NO_MORE_SEARCH_HANDLES = 113;
102: public const ERROR_INVALID_TARGET_HANDLE = 114;
103: public const ERROR_INVALID_CATEGORY = 117;
104: public const ERROR_INVALID_VERIFY_SWITCH = 118;
105: public const ERROR_BAD_DRIVER_LEVEL = 119;
106: public const ERROR_CALL_NOT_IMPLEMENTED = 120;
107: public const ERROR_SEM_TIMEOUT = 121;
108: public const ERROR_INSUFFICIENT_BUFFER = 122;
109: public const ERROR_INVALID_NAME = 123;
110: public const ERROR_INVALID_LEVEL = 124;
111: public const ERROR_NO_VOLUME_LABEL = 125;
112: public const ERROR_MOD_NOT_FOUND = 126;
113: public const ERROR_PROC_NOT_FOUND = 127;
114: public const ERROR_WAIT_NO_CHILDREN = 128;
115: public const ERROR_CHILD_NOT_COMPLETE = 129;
116: public const ERROR_DIRECT_ACCESS_HANDLE = 130;
117: public const ERROR_NEGATIVE_SEEK = 131;
118: public const ERROR_SEEK_ON_DEVICE = 132;
119: public const ERROR_IS_JOIN_TARGET = 133;
120: public const ERROR_IS_JOINED = 134;
121: public const ERROR_IS_SUBSTED = 135;
122: public const ERROR_NOT_JOINED = 136;
123: public const ERROR_NOT_SUBSTED = 137;
124: public const ERROR_JOIN_TO_JOIN = 138;
125: public const ERROR_SUBST_TO_SUBST = 139;
126: public const ERROR_JOIN_TO_SUBST = 140;
127: public const ERROR_SUBST_TO_JOIN = 141;
128: public const ERROR_BUSY_DRIVE = 142;
129: public const ERROR_SAME_DRIVE = 143;
130: public const ERROR_DIR_NOT_ROOT = 144;
131: public const ERROR_DIR_NOT_EMPTY = 145;
132: public const ERROR_IS_SUBST_PATH = 146;
133: public const ERROR_IS_JOIN_PATH = 147;
134: public const ERROR_PATH_BUSY = 148;
135: public const ERROR_IS_SUBST_TARGET = 149;
136: public const ERROR_SYSTEM_TRACE = 150;
137: public const ERROR_INVALID_EVENT_COUNT = 151;
138: public const ERROR_TOO_MANY_MUXWAITERS = 152;
139: public const ERROR_INVALID_LIST_FORMAT = 153;
140: public const ERROR_LABEL_TOO_LONG = 154;
141: public const ERROR_TOO_MANY_TCBS = 155;
142: public const ERROR_SIGNAL_REFUSED = 156;
143: public const ERROR_DISCARDED = 157;
144: public const ERROR_NOT_LOCKED = 158;
145: public const ERROR_BAD_THREADID_ADDR = 159;
146: public const ERROR_BAD_ARGUMENTS = 160;
147: public const ERROR_BAD_PATHNAME = 161;
148: public const ERROR_SIGNAL_PENDING = 162;
149: public const ERROR_MAX_THRDS_REACHED = 164;
150: public const ERROR_LOCK_FAILED = 167;
151: public const ERROR_BUSY = 170;
152: public const ERROR_DEVICE_SUPPORT_IN_PROGRESS = 171;
153: public const ERROR_CANCEL_VIOLATION = 173;
154: public const ERROR_ATOMIC_LOCKS_NOT_SUPPORTED = 174;
155: public const ERROR_INVALID_SEGMENT_NUMBER = 180;
156: public const ERROR_INVALID_ORDINAL = 182;
157: public const ERROR_ALREADY_EXISTS = 183;
158: public const ERROR_INVALID_FLAG_NUMBER = 186;
159: public const ERROR_SEM_NOT_FOUND = 187;
160: public const ERROR_INVALID_STARTING_CODESEG = 188;
161: public const ERROR_INVALID_STACKSEG = 189;
162: public const ERROR_INVALID_MODULETYPE = 190;
163: public const ERROR_INVALID_EXE_SIGNATURE = 191;
164: public const ERROR_EXE_MARKED_INVALID = 192;
165: public const ERROR_BAD_EXE_FORMAT = 193;
166: public const ERROR_ITERATED_DATA_EXCEEDS_64K = 194;
167: public const ERROR_INVALID_MINALLOCSIZE = 195;
168: public const ERROR_DYNLINK_FROM_INVALID_RING = 196;
169: public const ERROR_IOPL_NOT_ENABLED = 197;
170: public const ERROR_INVALID_SEGDPL = 198;
171: public const ERROR_AUTODATASEG_EXCEEDS_64K = 199;
172: public const ERROR_RING2SEG_MUST_BE_MOVABLE = 200;
173: public const ERROR_RELOC_CHAIN_XEEDS_SEGLIM = 201;
174: public const ERROR_INFLOOP_IN_RELOC_CHAIN = 202;
175: public const ERROR_ENVVAR_NOT_FOUND = 203;
176: public const ERROR_NO_SIGNAL_SENT = 205;
177: public const ERROR_FILENAME_EXCED_RANGE = 206;
178: public const ERROR_RING2_STACK_IN_USE = 207;
179: public const ERROR_META_EXPANSION_TOO_LONG = 208;
180: public const ERROR_INVALID_SIGNAL_NUMBER = 209;
181: public const ERROR_THREAD_1_INACTIVE = 210;
182: public const ERROR_LOCKED = 212;
183: public const ERROR_TOO_MANY_MODULES = 214;
184: public const ERROR_NESTING_NOT_ALLOWED = 215;
185: public const ERROR_EXE_MACHINE_TYPE_MISMATCH = 216;
186: public const ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY = 217;
187: public const ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY = 218;
188: public const ERROR_FILE_CHECKED_OUT = 220;
189: public const ERROR_CHECKOUT_REQUIRED = 221;
190: public const ERROR_BAD_FILE_TYPE = 222;
191: public const ERROR_FILE_TOO_LARGE = 223;
192: public const ERROR_FORMS_AUTH_REQUIRED = 224;
193: public const ERROR_VIRUS_INFECTED = 225;
194: public const ERROR_VIRUS_DELETED = 226;
195: public const ERROR_PIPE_LOCAL = 229;
196: public const ERROR_BAD_PIPE = 230;
197: public const ERROR_PIPE_BUSY = 231;
198: public const ERROR_NO_DATA = 232;
199: public const ERROR_PIPE_NOT_CONNECTED = 233;
200: public const ERROR_MORE_DATA = 234;
201: public const ERROR_VC_DISCONNECTED = 240;
202: public const ERROR_INVALID_EA_NAME = 254;
203: public const ERROR_EA_LIST_INCONSISTENT = 255;
204: public const WAIT_TIMEOUT = 258;
205: public const ERROR_NO_MORE_ITEMS = 259;
206: public const ERROR_CANNOT_COPY = 266;
207: public const ERROR_DIRECTORY = 267;
208: public const ERROR_EAS_DIDNT_FIT = 275;
209: public const ERROR_EA_FILE_CORRUPT = 276;
210: public const ERROR_EA_TABLE_FULL = 277;
211: public const ERROR_INVALID_EA_HANDLE = 278;
212: public const ERROR_EAS_NOT_SUPPORTED = 282;
213: public const ERROR_NOT_OWNER = 288;
214: public const ERROR_TOO_MANY_POSTS = 298;
215: public const ERROR_PARTIAL_COPY = 299;
216: public const ERROR_OPLOCK_NOT_GRANTED = 300;
217: public const ERROR_INVALID_OPLOCK_PROTOCOL = 301;
218: public const ERROR_DISK_TOO_FRAGMENTED = 302;
219: public const ERROR_DELETE_PENDING = 303;
220: public const ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING = 304;
221: public const ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME = 305;
222: public const ERROR_SECURITY_STREAM_IS_INCONSISTENT = 306;
223: public const ERROR_INVALID_LOCK_RANGE = 307;
224: public const ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT = 308;
225: public const ERROR_NOTIFICATION_GUID_ALREADY_DEFINED = 309;
226: public const ERROR_INVALID_EXCEPTION_HANDLER = 310;
227: public const ERROR_DUPLICATE_PRIVILEGES = 311;
228: public const ERROR_NO_RANGES_PROCESSED = 312;
229: public const ERROR_NOT_ALLOWED_ON_SYSTEM_FILE = 313;
230: public const ERROR_DISK_RESOURCES_EXHAUSTED = 314;
231: public const ERROR_INVALID_TOKEN = 315;
232: public const ERROR_DEVICE_FEATURE_NOT_SUPPORTED = 316;
233: public const ERROR_MR_MID_NOT_FOUND = 317;
234: public const ERROR_SCOPE_NOT_FOUND = 318;
235: public const ERROR_UNDEFINED_SCOPE = 319;
236: public const ERROR_INVALID_CAP = 320;
237: public const ERROR_DEVICE_UNREACHABLE = 321;
238: public const ERROR_DEVICE_NO_RESOURCES = 322;
239: public const ERROR_DATA_CHECKSUM_ERROR = 323;
240: public const ERROR_INTERMIXED_KERNEL_EA_OPERATION = 324;
241: public const ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED = 326;
242: public const ERROR_OFFSET_ALIGNMENT_VIOLATION = 327;
243: public const ERROR_INVALID_FIELD_IN_PARAMETER_LIST = 328;
244: public const ERROR_OPERATION_IN_PROGRESS = 329;
245: public const ERROR_BAD_DEVICE_PATH = 330;
246: public const ERROR_TOO_MANY_DESCRIPTORS = 331;
247: public const ERROR_SCRUB_DATA_DISABLED = 332;
248: public const ERROR_NOT_REDUNDANT_STORAGE = 333;
249: public const ERROR_RESIDENT_FILE_NOT_SUPPORTED = 334;
250: public const ERROR_COMPRESSED_FILE_NOT_SUPPORTED = 335;
251: public const ERROR_DIRECTORY_NOT_SUPPORTED = 336;
252: public const ERROR_NOT_READ_FROM_COPY = 337;
253: public const ERROR_FAIL_NOACTION_REBOOT = 350;
254: public const ERROR_FAIL_SHUTDOWN = 351;
255: public const ERROR_FAIL_RESTART = 352;
256: public const ERROR_MAX_SESSIONS_REACHED = 353;
257: public const ERROR_THREAD_MODE_ALREADY_BACKGROUND = 400;
258: public const ERROR_THREAD_MODE_NOT_BACKGROUND = 401;
259: public const ERROR_PROCESS_MODE_ALREADY_BACKGROUND = 402;
260: public const ERROR_PROCESS_MODE_NOT_BACKGROUND = 403;
261: public const ERROR_INVALID_ADDRESS = 487;
262: public const ERROR_USER_PROFILE_LOAD = 500;
263: public const ERROR_ARITHMETIC_OVERFLOW = 534;
264: public const ERROR_PIPE_CONNECTED = 535;
265: public const ERROR_PIPE_LISTENING = 536;
266: public const ERROR_VERIFIER_STOP = 537;
267: public const ERROR_ABIOS_ERROR = 538;
268: public const ERROR_WX86_WARNING = 539;
269: public const ERROR_WX86_ERROR = 540;
270: public const ERROR_TIMER_NOT_CANCELED = 541;
271: public const ERROR_UNWIND = 542;
272: public const ERROR_BAD_STACK = 543;
273: public const ERROR_INVALID_UNWIND_TARGET = 544;
274: public const ERROR_INVALID_PORT_ATTRIBUTES = 545;
275: public const ERROR_PORT_MESSAGE_TOO_LONG = 546;
276: public const ERROR_INVALID_QUOTA_LOWER = 547;
277: public const ERROR_DEVICE_ALREADY_ATTACHED = 548;
278: public const ERROR_INSTRUCTION_MISALIGNMENT = 549;
279: public const ERROR_PROFILING_NOT_STARTED = 550;
280: public const ERROR_PROFILING_NOT_STOPPED = 551;
281: public const ERROR_COULD_NOT_INTERPRET = 552;
282: public const ERROR_PROFILING_AT_LIMIT = 553;
283: public const ERROR_CANT_WAIT = 554;
284: public const ERROR_CANT_TERMINATE_SELF = 555;
285: public const ERROR_UNEXPECTED_MM_CREATE_ERR = 556;
286: public const ERROR_UNEXPECTED_MM_MAP_ERROR = 557;
287: public const ERROR_UNEXPECTED_MM_EXTEND_ERR = 558;
288: public const ERROR_BAD_FUNCTION_TABLE = 559;
289: public const ERROR_NO_GUID_TRANSLATION = 560;
290: public const ERROR_INVALID_LDT_SIZE = 561;
291: public const ERROR_INVALID_LDT_OFFSET = 563;
292: public const ERROR_INVALID_LDT_DESCRIPTOR = 564;
293: public const ERROR_TOO_MANY_THREADS = 565;
294: public const ERROR_THREAD_NOT_IN_PROCESS = 566;
295: public const ERROR_PAGEFILE_QUOTA_EXCEEDED = 567;
296: public const ERROR_LOGON_SERVER_CONFLICT = 568;
297: public const ERROR_SYNCHRONIZATION_REQUIRED = 569;
298: public const ERROR_NET_OPEN_FAILED = 570;
299: public const ERROR_IO_PRIVILEGE_FAILED = 571;
300: public const ERROR_CONTROL_C_EXIT = 572;
301: public const ERROR_MISSING_SYSTEMFILE = 573;
302: public const ERROR_UNHANDLED_EXCEPTION = 574;
303: public const ERROR_APP_INIT_FAILURE = 575;
304: public const ERROR_PAGEFILE_CREATE_FAILED = 576;
305: public const ERROR_INVALID_IMAGE_HASH = 577;
306: public const ERROR_NO_PAGEFILE = 578;
307: public const ERROR_ILLEGAL_FLOAT_CONTEXT = 579;
308: public const ERROR_NO_EVENT_PAIR = 580;
309: public const ERROR_DOMAIN_CTRLR_CONFIG_ERROR = 581;
310: public const ERROR_ILLEGAL_CHARACTER = 582;
311: public const ERROR_UNDEFINED_CHARACTER = 583;
312: public const ERROR_FLOPPY_VOLUME = 584;
313: public const ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT = 585;
314: public const ERROR_BACKUP_CONTROLLER = 586;
315: public const ERROR_MUTANT_LIMIT_EXCEEDED = 587;
316: public const ERROR_FS_DRIVER_REQUIRED = 588;
317: public const ERROR_CANNOT_LOAD_REGISTRY_FILE = 589;
318: public const ERROR_DEBUG_ATTACH_FAILED = 590;
319: public const ERROR_SYSTEM_PROCESS_TERMINATED = 591;
320: public const ERROR_DATA_NOT_ACCEPTED = 592;
321: public const ERROR_VDM_HARD_ERROR = 593;
322: public const ERROR_DRIVER_CANCEL_TIMEOUT = 594;
323: public const ERROR_REPLY_MESSAGE_MISMATCH = 595;
324: public const ERROR_LOST_WRITEBEHIND_DATA = 596;
325: public const ERROR_CLIENT_SERVER_PARAMETERS_INVALID = 597;
326: public const ERROR_NOT_TINY_STREAM = 598;
327: public const ERROR_STACK_OVERFLOW_READ = 599;
328: public const ERROR_CONVERT_TO_LARGE = 600;
329: public const ERROR_FOUND_OUT_OF_SCOPE = 601;
330: public const ERROR_ALLOCATE_BUCKET = 602;
331: public const ERROR_MARSHALL_OVERFLOW = 603;
332: public const ERROR_INVALID_VARIANT = 604;
333: public const ERROR_BAD_COMPRESSION_BUFFER = 605;
334: public const ERROR_AUDIT_FAILED = 606;
335: public const ERROR_TIMER_RESOLUTION_NOT_SET = 607;
336: public const ERROR_INSUFFICIENT_LOGON_INFO = 608;
337: public const ERROR_BAD_DLL_ENTRYPOINT = 609;
338: public const ERROR_BAD_SERVICE_ENTRYPOINT = 610;
339: public const ERROR_IP_ADDRESS_CONFLICT1 = 611;
340: public const ERROR_IP_ADDRESS_CONFLICT2 = 612;
341: public const ERROR_REGISTRY_QUOTA_LIMIT = 613;
342: public const ERROR_NO_CALLBACK_ACTIVE = 614;
343: public const ERROR_PWD_TOO_SHORT = 615;
344: public const ERROR_PWD_TOO_RECENT = 616;
345: public const ERROR_PWD_HISTORY_CONFLICT = 617;
346: public const ERROR_UNSUPPORTED_COMPRESSION = 618;
347: public const ERROR_INVALID_HW_PROFILE = 619;
348: public const ERROR_INVALID_PLUGPLAY_DEVICE_PATH = 620;
349: public const ERROR_QUOTA_LIST_INCONSISTENT = 621;
350: public const ERROR_EVALUATION_EXPIRATION = 622;
351: public const ERROR_ILLEGAL_DLL_RELOCATION = 623;
352: public const ERROR_DLL_INIT_FAILED_LOGOFF = 624;
353: public const ERROR_VALIDATE_CONTINUE = 625;
354: public const ERROR_NO_MORE_MATCHES = 626;
355: public const ERROR_RANGE_LIST_CONFLICT = 627;
356: public const ERROR_SERVER_SID_MISMATCH = 628;
357: public const ERROR_CANT_ENABLE_DENY_ONLY = 629;
358: public const ERROR_FLOAT_MULTIPLE_FAULTS = 630;
359: public const ERROR_FLOAT_MULTIPLE_TRAPS = 631;
360: public const ERROR_NOINTERFACE = 632;
361: public const ERROR_DRIVER_FAILED_SLEEP = 633;
362: public const ERROR_CORRUPT_SYSTEM_FILE = 634;
363: public const ERROR_COMMITMENT_MINIMUM = 635;
364: public const ERROR_PNP_RESTART_ENUMERATION = 636;
365: public const ERROR_SYSTEM_IMAGE_BAD_SIGNATURE = 637;
366: public const ERROR_PNP_REBOOT_REQUIRED = 638;
367: public const ERROR_INSUFFICIENT_POWER = 639;
368: public const ERROR_MULTIPLE_FAULT_VIOLATION = 640;
369: public const ERROR_SYSTEM_SHUTDOWN = 641;
370: public const ERROR_PORT_NOT_SET = 642;
371: public const ERROR_DS_VERSION_CHECK_FAILURE = 643;
372: public const ERROR_RANGE_NOT_FOUND = 644;
373: public const ERROR_NOT_SAFE_MODE_DRIVER = 646;
374: public const ERROR_FAILED_DRIVER_ENTRY = 647;
375: public const ERROR_DEVICE_ENUMERATION_ERROR = 648;
376: public const ERROR_MOUNT_POINT_NOT_RESOLVED = 649;
377: public const ERROR_INVALID_DEVICE_OBJECT_PARAMETER = 650;
378: public const ERROR_MCA_OCCURED = 651;
379: public const ERROR_DRIVER_DATABASE_ERROR = 652;
380: public const ERROR_SYSTEM_HIVE_TOO_LARGE = 653;
381: public const ERROR_DRIVER_FAILED_PRIOR_UNLOAD = 654;
382: public const ERROR_VOLSNAP_PREPARE_HIBERNATE = 655;
383: public const ERROR_HIBERNATION_FAILURE = 656;
384: public const ERROR_PWD_TOO_LONG = 657;
385: public const ERROR_FILE_SYSTEM_LIMITATION = 665;
386: public const ERROR_ASSERTION_FAILURE = 668;
387: public const ERROR_ACPI_ERROR = 669;
388: public const ERROR_WOW_ASSERTION = 670;
389: public const ERROR_PNP_BAD_MPS_TABLE = 671;
390: public const ERROR_PNP_TRANSLATION_FAILED = 672;
391: public const ERROR_PNP_IRQ_TRANSLATION_FAILED = 673;
392: public const ERROR_PNP_INVALID_ID = 674;
393: public const ERROR_WAKE_SYSTEM_DEBUGGER = 675;
394: public const ERROR_HANDLES_CLOSED = 676;
395: public const ERROR_EXTRANEOUS_INFORMATION = 677;
396: public const ERROR_RXACT_COMMIT_NECESSARY = 678;
397: public const ERROR_MEDIA_CHECK = 679;
398: public const ERROR_GUID_SUBSTITUTION_MADE = 680;
399: public const ERROR_STOPPED_ON_SYMLINK = 681;
400: public const ERROR_LONGJUMP = 682;
401: public const ERROR_PLUGPLAY_QUERY_VETOED = 683;
402: public const ERROR_UNWIND_CONSOLIDATE = 684;
403: public const ERROR_REGISTRY_HIVE_RECOVERED = 685;
404: public const ERROR_DLL_MIGHT_BE_INSECURE = 686;
405: public const ERROR_DLL_MIGHT_BE_INCOMPATIBLE = 687;
406: public const ERROR_DBG_EXCEPTION_NOT_HANDLED = 688;
407: public const ERROR_DBG_REPLY_LATER = 689;
408: public const ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE = 690;
409: public const ERROR_DBG_TERMINATE_THREAD = 691;
410: public const ERROR_DBG_TERMINATE_PROCESS = 692;
411: public const ERROR_DBG_CONTROL_C = 693;
412: public const ERROR_DBG_PRINTEXCEPTION_C = 694;
413: public const ERROR_DBG_RIPEXCEPTION = 695;
414: public const ERROR_DBG_CONTROL_BREAK = 696;
415: public const ERROR_DBG_COMMAND_EXCEPTION = 697;
416: public const ERROR_OBJECT_NAME_EXISTS = 698;
417: public const ERROR_THREAD_WAS_SUSPENDED = 699;
418: public const ERROR_IMAGE_NOT_AT_BASE = 700;
419: public const ERROR_RXACT_STATE_CREATED = 701;
420: public const ERROR_SEGMENT_NOTIFICATION = 702;
421: public const ERROR_BAD_CURRENT_DIRECTORY = 703;
422: public const ERROR_FT_READ_RECOVERY_FROM_BACKUP = 704;
423: public const ERROR_FT_WRITE_RECOVERY = 705;
424: public const ERROR_IMAGE_MACHINE_TYPE_MISMATCH = 706;
425: public const ERROR_RECEIVE_PARTIAL = 707;
426: public const ERROR_RECEIVE_EXPEDITED = 708;
427: public const ERROR_RECEIVE_PARTIAL_EXPEDITED = 709;
428: public const ERROR_EVENT_DONE = 710;
429: public const ERROR_EVENT_PENDING = 711;
430: public const ERROR_CHECKING_FILE_SYSTEM = 712;
431: public const ERROR_FATAL_APP_EXIT = 713;
432: public const ERROR_PREDEFINED_HANDLE = 714;
433: public const ERROR_WAS_UNLOCKED = 715;
434: public const ERROR_SERVICE_NOTIFICATION = 716;
435: public const ERROR_WAS_LOCKED = 717;
436: public const ERROR_LOG_HARD_ERROR = 718;
437: public const ERROR_ALREADY_WIN32 = 719;
438: public const ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE = 720;
439: public const ERROR_NO_YIELD_PERFORMED = 721;
440: public const ERROR_TIMER_RESUME_IGNORED = 722;
441: public const ERROR_ARBITRATION_UNHANDLED = 723;
442: public const ERROR_CARDBUS_NOT_SUPPORTED = 724;
443: public const ERROR_MP_PROCESSOR_MISMATCH = 725;
444: public const ERROR_HIBERNATED = 726;
445: public const ERROR_RESUME_HIBERNATION = 727;
446: public const ERROR_FIRMWARE_UPDATED = 728;
447: public const ERROR_DRIVERS_LEAKING_LOCKED_PAGES = 729;
448: public const ERROR_WAKE_SYSTEM = 730;
449: public const ERROR_WAIT_1 = 731;
450: public const ERROR_WAIT_2 = 732;
451: public const ERROR_WAIT_3 = 733;
452: public const ERROR_WAIT_63 = 734;
453: public const ERROR_ABANDONED_WAIT_0 = 735;
454: public const ERROR_ABANDONED_WAIT_63 = 736;
455: public const ERROR_USER_APC = 737;
456: public const ERROR_KERNEL_APC = 738;
457: public const ERROR_ALERTED = 739;
458: public const ERROR_ELEVATION_REQUIRED = 740;
459: public const ERROR_REPARSE = 741;
460: public const ERROR_OPLOCK_BREAK_IN_PROGRESS = 742;
461: public const ERROR_VOLUME_MOUNTED = 743;
462: public const ERROR_RXACT_COMMITTED = 744;
463: public const ERROR_NOTIFY_CLEANUP = 745;
464: public const ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED = 746;
465: public const ERROR_PAGE_FAULT_TRANSITION = 747;
466: public const ERROR_PAGE_FAULT_DEMAND_ZERO = 748;
467: public const ERROR_PAGE_FAULT_COPY_ON_WRITE = 749;
468: public const ERROR_PAGE_FAULT_GUARD_PAGE = 750;
469: public const ERROR_PAGE_FAULT_PAGING_FILE = 751;
470: public const ERROR_CACHE_PAGE_LOCKED = 752;
471: public const ERROR_CRASH_DUMP = 753;
472: public const ERROR_BUFFER_ALL_ZEROS = 754;
473: public const ERROR_REPARSE_OBJECT = 755;
474: public const ERROR_RESOURCE_REQUIREMENTS_CHANGED = 756;
475: public const ERROR_TRANSLATION_COMPLETE = 757;
476: public const ERROR_NOTHING_TO_TERMINATE = 758;
477: public const ERROR_PROCESS_NOT_IN_JOB = 759;
478: public const ERROR_PROCESS_IN_JOB = 760;
479: public const ERROR_VOLSNAP_HIBERNATE_READY = 761;
480: public const ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY = 762;
481: public const ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED = 763;
482: public const ERROR_INTERRUPT_STILL_CONNECTED = 764;
483: public const ERROR_WAIT_FOR_OPLOCK = 765;
484: public const ERROR_DBG_EXCEPTION_HANDLED = 766;
485: public const ERROR_DBG_CONTINUE = 767;
486: public const ERROR_CALLBACK_POP_STACK = 768;
487: public const ERROR_COMPRESSION_DISABLED = 769;
488: public const ERROR_CANTFETCHBACKWARDS = 770;
489: public const ERROR_CANTSCROLLBACKWARDS = 771;
490: public const ERROR_ROWSNOTRELEASED = 772;
491: public const ERROR_BAD_ACCESSOR_FLAGS = 773;
492: public const ERROR_ERRORS_ENCOUNTERED = 774;
493: public const ERROR_NOT_CAPABLE = 775;
494: public const ERROR_REQUEST_OUT_OF_SEQUENCE = 776;
495: public const ERROR_VERSION_PARSE_ERROR = 777;
496: public const ERROR_BADSTARTPOSITION = 778;
497: public const ERROR_MEMORY_HARDWARE = 779;
498: public const ERROR_DISK_REPAIR_DISABLED = 780;
499: public const ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE = 781;
500: public const ERROR_SYSTEM_POWERSTATE_TRANSITION = 782;
501: public const ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION = 783;
502: public const ERROR_MCA_EXCEPTION = 784;
503: public const ERROR_ACCESS_AUDIT_BY_POLICY = 785;
504: public const ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY = 786;
505: public const ERROR_ABANDON_HIBERFILE = 787;
506: public const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED = 788;
507: public const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR = 789;
508: public const ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR = 790;
509: public const ERROR_BAD_MCFG_TABLE = 791;
510: public const ERROR_DISK_REPAIR_REDIRECTED = 792;
511: public const ERROR_DISK_REPAIR_UNSUCCESSFUL = 793;
512: public const ERROR_CORRUPT_LOG_OVERFULL = 794;
513: public const ERROR_CORRUPT_LOG_CORRUPTED = 795;
514: public const ERROR_CORRUPT_LOG_UNAVAILABLE = 796;
515: public const ERROR_CORRUPT_LOG_DELETED_FULL = 797;
516: public const ERROR_CORRUPT_LOG_CLEARED = 798;
517: public const ERROR_ORPHAN_NAME_EXHAUSTED = 799;
518: public const ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE = 800;
519: public const ERROR_CANNOT_GRANT_REQUESTED_OPLOCK = 801;
520: public const ERROR_CANNOT_BREAK_OPLOCK = 802;
521: public const ERROR_OPLOCK_HANDLE_CLOSED = 803;
522: public const ERROR_NO_ACE_CONDITION = 804;
523: public const ERROR_INVALID_ACE_CONDITION = 805;
524: public const ERROR_FILE_HANDLE_REVOKED = 806;
525: public const ERROR_IMAGE_AT_DIFFERENT_BASE = 807;
526: public const ERROR_EA_ACCESS_DENIED = 994;
527: public const ERROR_OPERATION_ABORTED = 995;
528: public const ERROR_IO_INCOMPLETE = 996;
529: public const ERROR_IO_PENDING = 997;
530: public const ERROR_NOACCESS = 998;
531: public const ERROR_SWAPERROR = 999;
532: public const ERROR_STACK_OVERFLOW = 1001;
533: public const ERROR_INVALID_MESSAGE = 1002;
534: public const ERROR_CAN_NOT_COMPLETE = 1003;
535: public const ERROR_INVALID_FLAGS = 1004;
536: public const ERROR_UNRECOGNIZED_VOLUME = 1005;
537: public const ERROR_FILE_INVALID = 1006;
538: public const ERROR_FULLSCREEN_MODE = 1007;
539: public const ERROR_NO_TOKEN = 1008;
540: public const ERROR_BADDB = 1009;
541: public const ERROR_BADKEY = 1010;
542: public const ERROR_CANTOPEN = 1011;
543: public const ERROR_CANTREAD = 1012;
544: public const ERROR_CANTWRITE = 1013;
545: public const ERROR_REGISTRY_RECOVERED = 1014;
546: public const ERROR_REGISTRY_CORRUPT = 1015;
547: public const ERROR_REGISTRY_IO_FAILED = 1016;
548: public const ERROR_NOT_REGISTRY_FILE = 1017;
549: public const ERROR_KEY_DELETED = 1018;
550: public const ERROR_NO_LOG_SPACE = 1019;
551: public const ERROR_KEY_HAS_CHILDREN = 1020;
552: public const ERROR_CHILD_MUST_BE_VOLATILE = 1021;
553: public const ERROR_NOTIFY_ENUM_DIR = 1022;
554: public const ERROR_DEPENDENT_SERVICES_RUNNING = 1051;
555: public const ERROR_INVALID_SERVICE_CONTROL = 1052;
556: public const ERROR_SERVICE_REQUEST_TIMEOUT = 1053;
557: public const ERROR_SERVICE_NO_THREAD = 1054;
558: public const ERROR_SERVICE_DATABASE_LOCKED = 1055;
559: public const ERROR_SERVICE_ALREADY_RUNNING = 1056;
560: public const ERROR_INVALID_SERVICE_ACCOUNT = 1057;
561: public const ERROR_SERVICE_DISABLED = 1058;
562: public const ERROR_CIRCULAR_DEPENDENCY = 1059;
563: public const ERROR_SERVICE_DOES_NOT_EXIST = 1060;
564: public const ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061;
565: public const ERROR_SERVICE_NOT_ACTIVE = 1062;
566: public const ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063;
567: public const ERROR_EXCEPTION_IN_SERVICE = 1064;
568: public const ERROR_DATABASE_DOES_NOT_EXIST = 1065;
569: public const ERROR_SERVICE_SPECIFIC_ERROR = 1066;
570: public const ERROR_PROCESS_ABORTED = 1067;
571: public const ERROR_SERVICE_DEPENDENCY_FAIL = 1068;
572: public const ERROR_SERVICE_LOGON_FAILED = 1069;
573: public const ERROR_SERVICE_START_HANG = 1070;
574: public const ERROR_INVALID_SERVICE_LOCK = 1071;
575: public const ERROR_SERVICE_MARKED_FOR_DELETE = 1072;
576: public const ERROR_SERVICE_EXISTS = 1073;
577: public const ERROR_ALREADY_RUNNING_LKG = 1074;
578: public const ERROR_SERVICE_DEPENDENCY_DELETED = 1075;
579: public const ERROR_BOOT_ALREADY_ACCEPTED = 1076;
580: public const ERROR_SERVICE_NEVER_STARTED = 1077;
581: public const ERROR_DUPLICATE_SERVICE_NAME = 1078;
582: public const ERROR_DIFFERENT_SERVICE_ACCOUNT = 1079;
583: public const ERROR_CANNOT_DETECT_DRIVER_FAILURE = 1080;
584: public const ERROR_CANNOT_DETECT_PROCESS_ABORT = 1081;
585: public const ERROR_NO_RECOVERY_PROGRAM = 1082;
586: public const ERROR_SERVICE_NOT_IN_EXE = 1083;
587: public const ERROR_NOT_SAFEBOOT_SERVICE = 1084;
588: public const ERROR_END_OF_MEDIA = 1100;
589: public const ERROR_FILEMARK_DETECTED = 1101;
590: public const ERROR_BEGINNING_OF_MEDIA = 1102;
591: public const ERROR_SETMARK_DETECTED = 1103;
592: public const ERROR_NO_DATA_DETECTED = 1104;
593: public const ERROR_PARTITION_FAILURE = 1105;
594: public const ERROR_INVALID_BLOCK_LENGTH = 1106;
595: public const ERROR_DEVICE_NOT_PARTITIONED = 1107;
596: public const ERROR_UNABLE_TO_LOCK_MEDIA = 1108;
597: public const ERROR_UNABLE_TO_UNLOAD_MEDIA = 1109;
598: public const ERROR_MEDIA_CHANGED = 1110;
599: public const ERROR_BUS_RESET = 1111;
600: public const ERROR_NO_MEDIA_IN_DRIVE = 1112;
601: public const ERROR_NO_UNICODE_TRANSLATION = 1113;
602: public const ERROR_DLL_INIT_FAILED = 1114;
603: public const ERROR_SHUTDOWN_IN_PROGRESS = 1115;
604: public const ERROR_NO_SHUTDOWN_IN_PROGRESS = 1116;
605: public const ERROR_IO_DEVICE = 1117;
606: public const ERROR_SERIAL_NO_DEVICE = 1118;
607: public const ERROR_IRQ_BUSY = 1119;
608: public const ERROR_MORE_WRITES = 1120;
609: public const ERROR_COUNTER_TIMEOUT = 1121;
610: public const ERROR_FLOPPY_ID_MARK_NOT_FOUND = 1122;
611: public const ERROR_FLOPPY_WRONG_CYLINDER = 1123;
612: public const ERROR_FLOPPY_UNKNOWN_ERROR = 1124;
613: public const ERROR_FLOPPY_BAD_REGISTERS = 1125;
614: public const ERROR_DISK_RECALIBRATE_FAILED = 1126;
615: public const ERROR_DISK_OPERATION_FAILED = 1127;
616: public const ERROR_DISK_RESET_FAILED = 1128;
617: public const ERROR_EOM_OVERFLOW = 1129;
618: public const ERROR_NOT_ENOUGH_SERVER_MEMORY = 1130;
619: public const ERROR_POSSIBLE_DEADLOCK = 1131;
620: public const ERROR_MAPPED_ALIGNMENT = 1132;
621: public const ERROR_SET_POWER_STATE_VETOED = 1140;
622: public const ERROR_SET_POWER_STATE_FAILED = 1141;
623: public const ERROR_TOO_MANY_LINKS = 1142;
624: public const ERROR_OLD_WIN_VERSION = 1150;
625: public const ERROR_APP_WRONG_OS = 1151;
626: public const ERROR_SINGLE_INSTANCE_APP = 1152;
627: public const ERROR_RMODE_APP = 1153;
628: public const ERROR_INVALID_DLL = 1154;
629: public const ERROR_NO_ASSOCIATION = 1155;
630: public const ERROR_DDE_FAIL = 1156;
631: public const ERROR_DLL_NOT_FOUND = 1157;
632: public const ERROR_NO_MORE_USER_HANDLES = 1158;
633: public const ERROR_MESSAGE_SYNC_ONLY = 1159;
634: public const ERROR_SOURCE_ELEMENT_EMPTY = 1160;
635: public const ERROR_DESTINATION_ELEMENT_FULL = 1161;
636: public const ERROR_ILLEGAL_ELEMENT_ADDRESS = 1162;
637: public const ERROR_MAGAZINE_NOT_PRESENT = 1163;
638: public const ERROR_DEVICE_REINITIALIZATION_NEEDED = 1164;
639: public const ERROR_DEVICE_REQUIRES_CLEANING = 1165;
640: public const ERROR_DEVICE_DOOR_OPEN = 1166;
641: public const ERROR_DEVICE_NOT_CONNECTED = 1167;
642: public const ERROR_NOT_FOUND = 1168;
643: public const ERROR_NO_MATCH = 1169;
644: public const ERROR_SET_NOT_FOUND = 1170;
645: public const ERROR_POINT_NOT_FOUND = 1171;
646: public const ERROR_NO_TRACKING_SERVICE = 1172;
647: public const ERROR_NO_VOLUME_ID = 1173;
648: public const ERROR_UNABLE_TO_REMOVE_REPLACED = 1175;
649: public const ERROR_UNABLE_TO_MOVE_REPLACEMENT = 1176;
650: public const ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 = 1177;
651: public const ERROR_JOURNAL_DELETE_IN_PROGRESS = 1178;
652: public const ERROR_JOURNAL_NOT_ACTIVE = 1179;
653: public const ERROR_POTENTIAL_FILE_FOUND = 1180;
654: public const ERROR_JOURNAL_ENTRY_DELETED = 1181;
655: public const ERROR_SHUTDOWN_IS_SCHEDULED = 1190;
656: public const ERROR_SHUTDOWN_USERS_LOGGED_ON = 1191;
657: public const ERROR_BAD_DEVICE = 1200;
658: public const ERROR_CONNECTION_UNAVAIL = 1201;
659: public const ERROR_DEVICE_ALREADY_REMEMBERED = 1202;
660: public const ERROR_NO_NET_OR_BAD_PATH = 1203;
661: public const ERROR_BAD_PROVIDER = 1204;
662: public const ERROR_CANNOT_OPEN_PROFILE = 1205;
663: public const ERROR_BAD_PROFILE = 1206;
664: public const ERROR_NOT_CONTAINER = 1207;
665: public const ERROR_EXTENDED_ERROR = 1208;
666: public const ERROR_INVALID_GROUPNAME = 1209;
667: public const ERROR_INVALID_COMPUTERNAME = 1210;
668: public const ERROR_INVALID_EVENTNAME = 1211;
669: public const ERROR_INVALID_DOMAINNAME = 1212;
670: public const ERROR_INVALID_SERVICENAME = 1213;
671: public const ERROR_INVALID_NETNAME = 1214;
672: public const ERROR_INVALID_SHARENAME = 1215;
673: public const ERROR_INVALID_PASSWORDNAME = 1216;
674: public const ERROR_INVALID_MESSAGENAME = 1217;
675: public const ERROR_INVALID_MESSAGEDEST = 1218;
676: public const ERROR_SESSION_CREDENTIAL_CONFLICT = 1219;
677: public const ERROR_REMOTE_SESSION_LIMIT_EXCEEDED = 1220;
678: public const ERROR_DUP_DOMAINNAME = 1221;
679: public const ERROR_NO_NETWORK = 1222;
680: public const ERROR_CANCELLED = 1223;
681: public const ERROR_USER_MAPPED_FILE = 1224;
682: public const ERROR_CONNECTION_REFUSED = 1225;
683: public const ERROR_GRACEFUL_DISCONNECT = 1226;
684: public const ERROR_ADDRESS_ALREADY_ASSOCIATED = 1227;
685: public const ERROR_ADDRESS_NOT_ASSOCIATED = 1228;
686: public const ERROR_CONNECTION_INVALID = 1229;
687: public const ERROR_CONNECTION_ACTIVE = 1230;
688: public const ERROR_NETWORK_UNREACHABLE = 1231;
689: public const ERROR_HOST_UNREACHABLE = 1232;
690: public const ERROR_PROTOCOL_UNREACHABLE = 1233;
691: public const ERROR_PORT_UNREACHABLE = 1234;
692: public const ERROR_REQUEST_ABORTED = 1235;
693: public const ERROR_CONNECTION_ABORTED = 1236;
694: public const ERROR_RETRY = 1237;
695: public const ERROR_CONNECTION_COUNT_LIMIT = 1238;
696: public const ERROR_LOGIN_TIME_RESTRICTION = 1239;
697: public const ERROR_LOGIN_WKSTA_RESTRICTION = 1240;
698: public const ERROR_INCORRECT_ADDRESS = 1241;
699: public const ERROR_ALREADY_REGISTERED = 1242;
700: public const ERROR_SERVICE_NOT_FOUND = 1243;
701: public const ERROR_NOT_AUTHENTICATED = 1244;
702: public const ERROR_NOT_LOGGED_ON = 1245;
703: public const ERROR_CONTINUE = 1246;
704: public const ERROR_ALREADY_INITIALIZED = 1247;
705: public const ERROR_NO_MORE_DEVICES = 1248;
706: public const ERROR_NO_SUCH_SITE = 1249;
707: public const ERROR_DOMAIN_CONTROLLER_EXISTS = 1250;
708: public const ERROR_ONLY_IF_CONNECTED = 1251;
709: public const ERROR_OVERRIDE_NOCHANGES = 1252;
710: public const ERROR_BAD_USER_PROFILE = 1253;
711: public const ERROR_NOT_SUPPORTED_ON_SBS = 1254;
712: public const ERROR_SERVER_SHUTDOWN_IN_PROGRESS = 1255;
713: public const ERROR_HOST_DOWN = 1256;
714: public const ERROR_NON_ACCOUNT_SID = 1257;
715: public const ERROR_NON_DOMAIN_SID = 1258;
716: public const ERROR_APPHELP_BLOCK = 1259;
717: public const ERROR_ACCESS_DISABLED_BY_POLICY = 1260;
718: public const ERROR_REG_NAT_CONSUMPTION = 1261;
719: public const ERROR_CSCSHARE_OFFLINE = 1262;
720: public const ERROR_PKINIT_FAILURE = 1263;
721: public const ERROR_SMARTCARD_SUBSYSTEM_FAILURE = 1264;
722: public const ERROR_DOWNGRADE_DETECTED = 1265;
723: public const ERROR_MACHINE_LOCKED = 1271;
724: public const ERROR_CALLBACK_SUPPLIED_INVALID_DATA = 1273;
725: public const ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED = 1274;
726: public const ERROR_DRIVER_BLOCKED = 1275;
727: public const ERROR_INVALID_IMPORT_OF_NON_DLL = 1276;
728: public const ERROR_ACCESS_DISABLED_WEBBLADE = 1277;
729: public const ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER = 1278;
730: public const ERROR_RECOVERY_FAILURE = 1279;
731: public const ERROR_ALREADY_FIBER = 1280;
732: public const ERROR_ALREADY_THREAD = 1281;
733: public const ERROR_STACK_BUFFER_OVERRUN = 1282;
734: public const ERROR_PARAMETER_QUOTA_EXCEEDED = 1283;
735: public const ERROR_DEBUGGER_INACTIVE = 1284;
736: public const ERROR_DELAY_LOAD_FAILED = 1285;
737: public const ERROR_VDM_DISALLOWED = 1286;
738: public const ERROR_UNIDENTIFIED_ERROR = 1287;
739: public const ERROR_INVALID_CRUNTIME_PARAMETER = 1288;
740: public const ERROR_BEYOND_VDL = 1289;
741: public const ERROR_INCOMPATIBLE_SERVICE_SID_TYPE = 1290;
742: public const ERROR_DRIVER_PROCESS_TERMINATED = 1291;
743: public const ERROR_IMPLEMENTATION_LIMIT = 1292;
744: public const ERROR_PROCESS_IS_PROTECTED = 1293;
745: public const ERROR_SERVICE_NOTIFY_CLIENT_LAGGING = 1294;
746: public const ERROR_DISK_QUOTA_EXCEEDED = 1295;
747: public const ERROR_CONTENT_BLOCKED = 1296;
748: public const ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE = 1297;
749: public const ERROR_APP_HANG = 1298;
750: public const ERROR_INVALID_LABEL = 1299;
751: public const ERROR_NOT_ALL_ASSIGNED = 1300;
752: public const ERROR_SOME_NOT_MAPPED = 1301;
753: public const ERROR_NO_QUOTAS_FOR_ACCOUNT = 1302;
754: public const ERROR_LOCAL_USER_SESSION_KEY = 1303;
755: public const ERROR_NULL_LM_PASSWORD = 1304;
756: public const ERROR_UNKNOWN_REVISION = 1305;
757: public const ERROR_REVISION_MISMATCH = 1306;
758: public const ERROR_INVALID_OWNER = 1307;
759: public const ERROR_INVALID_PRIMARY_GROUP = 1308;
760: public const ERROR_NO_IMPERSONATION_TOKEN = 1309;
761: public const ERROR_CANT_DISABLE_MANDATORY = 1310;
762: public const ERROR_NO_LOGON_SERVERS = 1311;
763: public const ERROR_NO_SUCH_LOGON_SESSION = 1312;
764: public const ERROR_NO_SUCH_PRIVILEGE = 1313;
765: public const ERROR_PRIVILEGE_NOT_HELD = 1314;
766: public const ERROR_INVALID_ACCOUNT_NAME = 1315;
767: public const ERROR_USER_EXISTS = 1316;
768: public const ERROR_NO_SUCH_USER = 1317;
769: public const ERROR_GROUP_EXISTS = 1318;
770: public const ERROR_NO_SUCH_GROUP = 1319;
771: public const ERROR_MEMBER_IN_GROUP = 1320;
772: public const ERROR_MEMBER_NOT_IN_GROUP = 1321;
773: public const ERROR_LAST_ADMIN = 1322;
774: public const ERROR_WRONG_PASSWORD = 1323;
775: public const ERROR_ILL_FORMED_PASSWORD = 1324;
776: public const ERROR_PASSWORD_RESTRICTION = 1325;
777: public const ERROR_LOGON_FAILURE = 1326;
778: public const ERROR_ACCOUNT_RESTRICTION = 1327;
779: public const ERROR_INVALID_LOGON_HOURS = 1328;
780: public const ERROR_INVALID_WORKSTATION = 1329;
781: public const ERROR_PASSWORD_EXPIRED = 1330;
782: public const ERROR_ACCOUNT_DISABLED = 1331;
783: public const ERROR_NONE_MAPPED = 1332;
784: public const ERROR_TOO_MANY_LUIDS_REQUESTED = 1333;
785: public const ERROR_LUIDS_EXHAUSTED = 1334;
786: public const ERROR_INVALID_SUB_AUTHORITY = 1335;
787: public const ERROR_INVALID_ACL = 1336;
788: public const ERROR_INVALID_SID = 1337;
789: public const ERROR_INVALID_SECURITY_DESCR = 1338;
790: public const ERROR_BAD_INHERITANCE_ACL = 1340;
791: public const ERROR_SERVER_DISABLED = 1341;
792: public const ERROR_SERVER_NOT_DISABLED = 1342;
793: public const ERROR_INVALID_ID_AUTHORITY = 1343;
794: public const ERROR_ALLOTTED_SPACE_EXCEEDED = 1344;
795: public const ERROR_INVALID_GROUP_ATTRIBUTES = 1345;
796: public const ERROR_BAD_IMPERSONATION_LEVEL = 1346;
797: public const ERROR_CANT_OPEN_ANONYMOUS = 1347;
798: public const ERROR_BAD_VALIDATION_CLASS = 1348;
799: public const ERROR_BAD_TOKEN_TYPE = 1349;
800: public const ERROR_NO_SECURITY_ON_OBJECT = 1350;
801: public const ERROR_CANT_ACCESS_DOMAIN_INFO = 1351;
802: public const ERROR_INVALID_SERVER_STATE = 1352;
803: public const ERROR_INVALID_DOMAIN_STATE = 1353;
804: public const ERROR_INVALID_DOMAIN_ROLE = 1354;
805: public const ERROR_NO_SUCH_DOMAIN = 1355;
806: public const ERROR_DOMAIN_EXISTS = 1356;
807: public const ERROR_DOMAIN_LIMIT_EXCEEDED = 1357;
808: public const ERROR_INTERNAL_DB_CORRUPTION = 1358;
809: public const ERROR_INTERNAL_ERROR = 1359;
810: public const ERROR_GENERIC_NOT_MAPPED = 1360;
811: public const ERROR_BAD_DESCRIPTOR_FORMAT = 1361;
812: public const ERROR_NOT_LOGON_PROCESS = 1362;
813: public const ERROR_LOGON_SESSION_EXISTS = 1363;
814: public const ERROR_NO_SUCH_PACKAGE = 1364;
815: public const ERROR_BAD_LOGON_SESSION_STATE = 1365;
816: public const ERROR_LOGON_SESSION_COLLISION = 1366;
817: public const ERROR_INVALID_LOGON_TYPE = 1367;
818: public const ERROR_CANNOT_IMPERSONATE = 1368;
819: public const ERROR_RXACT_INVALID_STATE = 1369;
820: public const ERROR_RXACT_COMMIT_FAILURE = 1370;
821: public const ERROR_SPECIAL_ACCOUNT = 1371;
822: public const ERROR_SPECIAL_GROUP = 1372;
823: public const ERROR_SPECIAL_USER = 1373;
824: public const ERROR_MEMBERS_PRIMARY_GROUP = 1374;
825: public const ERROR_TOKEN_ALREADY_IN_USE = 1375;
826: public const ERROR_NO_SUCH_ALIAS = 1376;
827: public const ERROR_MEMBER_NOT_IN_ALIAS = 1377;
828: public const ERROR_MEMBER_IN_ALIAS = 1378;
829: public const ERROR_ALIAS_EXISTS = 1379;
830: public const ERROR_LOGON_NOT_GRANTED = 1380;
831: public const ERROR_TOO_MANY_SECRETS = 1381;
832: public const ERROR_SECRET_TOO_LONG = 1382;
833: public const ERROR_INTERNAL_DB_ERROR = 1383;
834: public const ERROR_TOO_MANY_CONTEXT_IDS = 1384;
835: public const ERROR_LOGON_TYPE_NOT_GRANTED = 1385;
836: public const ERROR_NT_CROSS_ENCRYPTION_REQUIRED = 1386;
837: public const ERROR_NO_SUCH_MEMBER = 1387;
838: public const ERROR_INVALID_MEMBER = 1388;
839: public const ERROR_TOO_MANY_SIDS = 1389;
840: public const ERROR_LM_CROSS_ENCRYPTION_REQUIRED = 1390;
841: public const ERROR_NO_INHERITANCE = 1391;
842: public const ERROR_FILE_CORRUPT = 1392;
843: public const ERROR_DISK_CORRUPT = 1393;
844: public const ERROR_NO_USER_SESSION_KEY = 1394;
845: public const ERROR_LICENSE_QUOTA_EXCEEDED = 1395;
846: public const ERROR_WRONG_TARGET_NAME = 1396;
847: public const ERROR_MUTUAL_AUTH_FAILED = 1397;
848: public const ERROR_TIME_SKEW = 1398;
849: public const ERROR_CURRENT_DOMAIN_NOT_ALLOWED = 1399;
850: public const ERROR_INVALID_WINDOW_HANDLE = 1400;
851: public const ERROR_INVALID_MENU_HANDLE = 1401;
852: public const ERROR_INVALID_CURSOR_HANDLE = 1402;
853: public const ERROR_INVALID_ACCEL_HANDLE = 1403;
854: public const ERROR_INVALID_HOOK_HANDLE = 1404;
855: public const ERROR_INVALID_DWP_HANDLE = 1405;
856: public const ERROR_TLW_WITH_WSCHILD = 1406;
857: public const ERROR_CANNOT_FIND_WND_CLASS = 1407;
858: public const ERROR_WINDOW_OF_OTHER_THREAD = 1408;
859: public const ERROR_HOTKEY_ALREADY_REGISTERED = 1409;
860: public const ERROR_CLASS_ALREADY_EXISTS = 1410;
861: public const ERROR_CLASS_DOES_NOT_EXIST = 1411;
862: public const ERROR_CLASS_HAS_WINDOWS = 1412;
863: public const ERROR_INVALID_INDEX = 1413;
864: public const ERROR_INVALID_ICON_HANDLE = 1414;
865: public const ERROR_PRIVATE_DIALOG_INDEX = 1415;
866: public const ERROR_LISTBOX_ID_NOT_FOUND = 1416;
867: public const ERROR_NO_WILDCARD_CHARACTERS = 1417;
868: public const ERROR_CLIPBOARD_NOT_OPEN = 1418;
869: public const ERROR_HOTKEY_NOT_REGISTERED = 1419;
870: public const ERROR_WINDOW_NOT_DIALOG = 1420;
871: public const ERROR_CONTROL_ID_NOT_FOUND = 1421;
872: public const ERROR_INVALID_COMBOBOX_MESSAGE = 1422;
873: public const ERROR_WINDOW_NOT_COMBOBOX = 1423;
874: public const ERROR_INVALID_EDIT_HEIGHT = 1424;
875: public const ERROR_DC_NOT_FOUND = 1425;
876: public const ERROR_INVALID_HOOK_FILTER = 1426;
877: public const ERROR_INVALID_FILTER_PROC = 1427;
878: public const ERROR_HOOK_NEEDS_HMOD = 1428;
879: public const ERROR_GLOBAL_ONLY_HOOK = 1429;
880: public const ERROR_JOURNAL_HOOK_SET = 1430;
881: public const ERROR_HOOK_NOT_INSTALLED = 1431;
882: public const ERROR_INVALID_LB_MESSAGE = 1432;
883: public const ERROR_SETCOUNT_ON_BAD_LB = 1433;
884: public const ERROR_LB_WITHOUT_TABSTOPS = 1434;
885: public const ERROR_DESTROY_OBJECT_OF_OTHER_THREAD = 1435;
886: public const ERROR_CHILD_WINDOW_MENU = 1436;
887: public const ERROR_NO_SYSTEM_MENU = 1437;
888: public const ERROR_INVALID_MSGBOX_STYLE = 1438;
889: public const ERROR_INVALID_SPI_VALUE = 1439;
890: public const ERROR_SCREEN_ALREADY_LOCKED = 1440;
891: public const ERROR_HWNDS_HAVE_DIFF_PARENT = 1441;
892: public const ERROR_NOT_CHILD_WINDOW = 1442;
893: public const ERROR_INVALID_GW_COMMAND = 1443;
894: public const ERROR_INVALID_THREAD_ID = 1444;
895: public const ERROR_NON_MDICHILD_WINDOW = 1445;
896: public const ERROR_POPUP_ALREADY_ACTIVE = 1446;
897: public const ERROR_NO_SCROLLBARS = 1447;
898: public const ERROR_INVALID_SCROLLBAR_RANGE = 1448;
899: public const ERROR_INVALID_SHOWWIN_COMMAND = 1449;
900: public const ERROR_NO_SYSTEM_RESOURCES = 1450;
901: public const ERROR_NONPAGED_SYSTEM_RESOURCES = 1451;
902: public const ERROR_PAGED_SYSTEM_RESOURCES = 1452;
903: public const ERROR_WORKING_SET_QUOTA = 1453;
904: public const ERROR_PAGEFILE_QUOTA = 1454;
905: public const ERROR_COMMITMENT_LIMIT = 1455;
906: public const ERROR_MENU_ITEM_NOT_FOUND = 1456;
907: public const ERROR_INVALID_KEYBOARD_HANDLE = 1457;
908: public const ERROR_HOOK_TYPE_NOT_ALLOWED = 1458;
909: public const ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION = 1459;
910: public const ERROR_TIMEOUT = 1460;
911: public const ERROR_INVALID_MONITOR_HANDLE = 1461;
912: public const ERROR_INCORRECT_SIZE = 1462;
913: public const ERROR_SYMLINK_CLASS_DISABLED = 1463;
914: public const ERROR_SYMLINK_NOT_SUPPORTED = 1464;
915: public const ERROR_XML_PARSE_ERROR = 1465;
916: public const ERROR_XMLDSIG_ERROR = 1466;
917: public const ERROR_RESTART_APPLICATION = 1467;
918: public const ERROR_WRONG_COMPARTMENT = 1468;
919: public const ERROR_AUTHIP_FAILURE = 1469;
920: public const ERROR_NO_NVRAM_RESOURCES = 1470;
921: public const ERROR_NOT_GUI_PROCESS = 1471;
922: public const ERROR_EVENTLOG_FILE_CORRUPT = 1500;
923: public const ERROR_EVENTLOG_CANT_START = 1501;
924: public const ERROR_LOG_FILE_FULL = 1502;
925: public const ERROR_EVENTLOG_FILE_CHANGED = 1503;
926: public const ERROR_INVALID_TASK_NAME = 1550;
927: public const ERROR_INVALID_TASK_INDEX = 1551;
928: public const ERROR_THREAD_ALREADY_IN_TASK = 1552;
929: public const ERROR_INSTALL_SERVICE_FAILURE = 1601;
930: public const ERROR_INSTALL_USEREXIT = 1602;
931: public const ERROR_INSTALL_FAILURE = 1603;
932: public const ERROR_INSTALL_SUSPEND = 1604;
933: public const ERROR_UNKNOWN_PRODUCT = 1605;
934: public const ERROR_UNKNOWN_FEATURE = 1606;
935: public const ERROR_UNKNOWN_COMPONENT = 1607;
936: public const ERROR_UNKNOWN_PROPERTY = 1608;
937: public const ERROR_INVALID_HANDLE_STATE = 1609;
938: public const ERROR_BAD_CONFIGURATION = 1610;
939: public const ERROR_INDEX_ABSENT = 1611;
940: public const ERROR_INSTALL_SOURCE_ABSENT = 1612;
941: public const ERROR_INSTALL_PACKAGE_VERSION = 1613;
942: public const ERROR_PRODUCT_UNINSTALLED = 1614;
943: public const ERROR_BAD_QUERY_SYNTAX = 1615;
944: public const ERROR_INVALID_FIELD = 1616;
945: public const ERROR_DEVICE_REMOVED = 1617;
946: public const ERROR_INSTALL_ALREADY_RUNNING = 1618;
947: public const ERROR_INSTALL_PACKAGE_OPEN_FAILED = 1619;
948: public const ERROR_INSTALL_PACKAGE_INVALID = 1620;
949: public const ERROR_INSTALL_UI_FAILURE = 1621;
950: public const ERROR_INSTALL_LOG_FAILURE = 1622;
951: public const ERROR_INSTALL_LANGUAGE_UNSUPPORTED = 1623;
952: public const ERROR_INSTALL_TRANSFORM_FAILURE = 1624;
953: public const ERROR_INSTALL_PACKAGE_REJECTED = 1625;
954: public const ERROR_FUNCTION_NOT_CALLED = 1626;
955: public const ERROR_FUNCTION_FAILED = 1627;
956: public const ERROR_INVALID_TABLE = 1628;
957: public const ERROR_DATATYPE_MISMATCH = 1629;
958: public const ERROR_UNSUPPORTED_TYPE = 1630;
959: public const ERROR_CREATE_FAILED = 1631;
960: public const ERROR_INSTALL_TEMP_UNWRITABLE = 1632;
961: public const ERROR_INSTALL_PLATFORM_UNSUPPORTED = 1633;
962: public const ERROR_INSTALL_NOTUSED = 1634;
963: public const ERROR_PATCH_PACKAGE_OPEN_FAILED = 1635;
964: public const ERROR_PATCH_PACKAGE_INVALID = 1636;
965: public const ERROR_PATCH_PACKAGE_UNSUPPORTED = 1637;
966: public const ERROR_PRODUCT_VERSION = 1638;
967: public const ERROR_INVALID_COMMAND_LINE = 1639;
968: public const ERROR_INSTALL_REMOTE_DISALLOWED = 1640;
969: public const ERROR_SUCCESS_REBOOT_INITIATED = 1641;
970: public const ERROR_PATCH_TARGET_NOT_FOUND = 1642;
971: public const ERROR_PATCH_PACKAGE_REJECTED = 1643;
972: public const ERROR_INSTALL_TRANSFORM_REJECTED = 1644;
973: public const ERROR_INSTALL_REMOTE_PROHIBITED = 1645;
974: public const ERROR_PATCH_REMOVAL_UNSUPPORTED = 1646;
975: public const ERROR_UNKNOWN_PATCH = 1647;
976: public const ERROR_PATCH_NO_SEQUENCE = 1648;
977: public const ERROR_PATCH_REMOVAL_DISALLOWED = 1649;
978: public const ERROR_INVALID_PATCH_XML = 1650;
979: public const ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT = 1651;
980: public const ERROR_INSTALL_SERVICE_SAFEBOOT = 1652;
981: public const ERROR_FAIL_FAST_EXCEPTION = 1653;
982: public const ERROR_INSTALL_REJECTED = 1654;
983:
984: public const RPC_S_INVALID_STRING_BINDING = 1700;
985: public const RPC_S_WRONG_KIND_OF_BINDING = 1701;
986: public const RPC_S_INVALID_BINDING = 1702;
987: public const RPC_S_PROTSEQ_NOT_SUPPORTED = 1703;
988: public const RPC_S_INVALID_RPC_PROTSEQ = 1704;
989: public const RPC_S_INVALID_STRING_UUID = 1705;
990: public const RPC_S_INVALID_ENDPOINT_FORMAT = 1706;
991: public const RPC_S_INVALID_NET_ADDR = 1707;
992: public const RPC_S_NO_ENDPOINT_FOUND = 1708;
993: public const RPC_S_INVALID_TIMEOUT = 1709;
994: public const RPC_S_OBJECT_NOT_FOUND = 1710;
995: public const RPC_S_ALREADY_REGISTERED = 1711;
996: public const RPC_S_TYPE_ALREADY_REGISTERED = 1712;
997: public const RPC_S_ALREADY_LISTENING = 1713;
998: public const RPC_S_NO_PROTSEQS_REGISTERED = 1714;
999: public const RPC_S_NOT_LISTENING = 1715;
1000: public const RPC_S_UNKNOWN_MGR_TYPE = 1716;
1001: public const RPC_S_UNKNOWN_IF = 1717;
1002: public const RPC_S_NO_BINDINGS = 1718;
1003: public const RPC_S_NO_PROTSEQS = 1719;
1004: public const RPC_S_CANT_CREATE_ENDPOINT = 1720;
1005: public const RPC_S_OUT_OF_RESOURCES = 1721;
1006: public const RPC_S_SERVER_UNAVAILABLE = 1722;
1007: public const RPC_S_SERVER_TOO_BUSY = 1723;
1008: public const RPC_S_INVALID_NETWORK_OPTIONS = 1724;
1009: public const RPC_S_NO_CALL_ACTIVE = 1725;
1010: public const RPC_S_CALL_FAILED = 1726;
1011: public const RPC_S_CALL_FAILED_DNE = 1727;
1012: public const RPC_S_PROTOCOL_ERROR = 1728;
1013: public const RPC_S_PROXY_ACCESS_DENIED = 1729;
1014: public const RPC_S_UNSUPPORTED_TRANS_SYN = 1730;
1015: public const RPC_S_UNSUPPORTED_TYPE = 1732;
1016: public const RPC_S_INVALID_TAG = 1733;
1017: public const RPC_S_INVALID_BOUND = 1734;
1018: public const RPC_S_NO_ENTRY_NAME = 1735;
1019: public const RPC_S_INVALID_NAME_SYNTAX = 1736;
1020: public const RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737;
1021: public const RPC_S_UUID_NO_ADDRESS = 1739;
1022: public const RPC_S_DUPLICATE_ENDPOINT = 1740;
1023: public const RPC_S_UNKNOWN_AUTHN_TYPE = 1741;
1024: public const RPC_S_MAX_CALLS_TOO_SMALL = 1742;
1025: public const RPC_S_STRING_TOO_LONG = 1743;
1026: public const RPC_S_PROTSEQ_NOT_FOUND = 1744;
1027: public const RPC_S_PROCNUM_OUT_OF_RANGE = 1745;
1028: public const RPC_S_BINDING_HAS_NO_AUTH = 1746;
1029: public const RPC_S_UNKNOWN_AUTHN_SERVICE = 1747;
1030: public const RPC_S_UNKNOWN_AUTHN_LEVEL = 1748;
1031: public const RPC_S_INVALID_AUTH_IDENTITY = 1749;
1032: public const RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750;
1033: public const EPT_S_INVALID_ENTRY = 1751;
1034: public const EPT_S_CANT_PERFORM_OP = 1752;
1035: public const EPT_S_NOT_REGISTERED = 1753;
1036: public const RPC_S_NOTHING_TO_EXPORT = 1754;
1037: public const RPC_S_INCOMPLETE_NAME = 1755;
1038: public const RPC_S_INVALID_VERS_OPTION = 1756;
1039: public const RPC_S_NO_MORE_MEMBERS = 1757;
1040: public const RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758;
1041: public const RPC_S_INTERFACE_NOT_FOUND = 1759;
1042: public const RPC_S_ENTRY_ALREADY_EXISTS = 1760;
1043: public const RPC_S_ENTRY_NOT_FOUND = 1761;
1044: public const RPC_S_NAME_SERVICE_UNAVAILABLE = 1762;
1045: public const RPC_S_INVALID_NAF_ID = 1763;
1046: public const RPC_S_CANNOT_SUPPORT = 1764;
1047: public const RPC_S_NO_CONTEXT_AVAILABLE = 1765;
1048: public const RPC_S_INTERNAL_ERROR = 1766;
1049: public const RPC_S_ZERO_DIVIDE = 1767;
1050: public const RPC_S_ADDRESS_ERROR = 1768;
1051: public const RPC_S_FP_DIV_ZERO = 1769;
1052: public const RPC_S_FP_UNDERFLOW = 1770;
1053: public const RPC_S_FP_OVERFLOW = 1771;
1054: public const RPC_X_NO_MORE_ENTRIES = 1772;
1055: public const RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773;
1056: public const RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774;
1057: public const RPC_X_SS_IN_NULL_CONTEXT = 1775;
1058: public const RPC_X_SS_CONTEXT_DAMAGED = 1777;
1059: public const RPC_X_SS_HANDLES_MISMATCH = 1778;
1060: public const RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779;
1061: public const RPC_X_NULL_REF_POINTER = 1780;
1062: public const RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781;
1063: public const RPC_X_BYTE_COUNT_TOO_SMALL = 1782;
1064: public const RPC_X_BAD_STUB_DATA = 1783;
1065: public const ERROR_INVALID_USER_BUFFER = 1784;
1066: public const ERROR_UNRECOGNIZED_MEDIA = 1785;
1067: public const ERROR_NO_TRUST_LSA_SECRET = 1786;
1068: public const ERROR_NO_TRUST_SAM_ACCOUNT = 1787;
1069: public const ERROR_TRUSTED_DOMAIN_FAILURE = 1788;
1070: public const ERROR_TRUSTED_RELATIONSHIP_FAILURE = 1789;
1071: public const ERROR_TRUST_FAILURE = 1790;
1072: public const RPC_S_CALL_IN_PROGRESS = 1791;
1073: public const ERROR_NETLOGON_NOT_STARTED = 1792;
1074: public const ERROR_ACCOUNT_EXPIRED = 1793;
1075: public const ERROR_REDIRECTOR_HAS_OPEN_HANDLES = 1794;
1076: public const ERROR_PRINTER_DRIVER_ALREADY_INSTALLED = 1795;
1077: public const ERROR_UNKNOWN_PORT = 1796;
1078: public const ERROR_UNKNOWN_PRINTER_DRIVER = 1797;
1079: public const ERROR_UNKNOWN_PRINTPROCESSOR = 1798;
1080: public const ERROR_INVALID_SEPARATOR_FILE = 1799;
1081: public const ERROR_INVALID_PRIORITY = 1800;
1082: public const ERROR_INVALID_PRINTER_NAME = 1801;
1083: public const ERROR_PRINTER_ALREADY_EXISTS = 1802;
1084: public const ERROR_INVALID_PRINTER_COMMAND = 1803;
1085: public const ERROR_INVALID_DATATYPE = 1804;
1086: public const ERROR_INVALID_ENVIRONMENT = 1805;
1087: public const RPC_S_NO_MORE_BINDINGS = 1806;
1088: public const ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807;
1089: public const ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808;
1090: public const ERROR_NOLOGON_SERVER_TRUST_ACCOUNT = 1809;
1091: public const ERROR_DOMAIN_TRUST_INCONSISTENT = 1810;
1092: public const ERROR_SERVER_HAS_OPEN_HANDLES = 1811;
1093: public const ERROR_RESOURCE_DATA_NOT_FOUND = 1812;
1094: public const ERROR_RESOURCE_TYPE_NOT_FOUND = 1813;
1095: public const ERROR_RESOURCE_NAME_NOT_FOUND = 1814;
1096: public const ERROR_RESOURCE_LANG_NOT_FOUND = 1815;
1097: public const ERROR_NOT_ENOUGH_QUOTA = 1816;
1098: public const RPC_S_NO_INTERFACES = 1817;
1099: public const RPC_S_CALL_CANCELLED = 1818;
1100: public const RPC_S_BINDING_INCOMPLETE = 1819;
1101: public const RPC_S_COMM_FAILURE = 1820;
1102: public const RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821;
1103: public const RPC_S_NO_PRINC_NAME = 1822;
1104: public const RPC_S_NOT_RPC_ERROR = 1823;
1105: public const RPC_S_UUID_LOCAL_ONLY = 1824;
1106: public const RPC_S_SEC_PKG_ERROR = 1825;
1107: public const RPC_S_NOT_CANCELLED = 1826;
1108: public const RPC_X_INVALID_ES_ACTION = 1827;
1109: public const RPC_X_WRONG_ES_VERSION = 1828;
1110: public const RPC_X_WRONG_STUB_VERSION = 1829;
1111: public const RPC_X_INVALID_PIPE_OBJECT = 1830;
1112: public const RPC_X_WRONG_PIPE_ORDER = 1831;
1113: public const RPC_X_WRONG_PIPE_VERSION = 1832;
1114: public const RPC_S_COOKIE_AUTH_FAILED = 1833;
1115: public const RPC_S_GROUP_MEMBER_NOT_FOUND = 1898;
1116: public const EPT_S_CANT_CREATE = 1899;
1117: public const RPC_S_INVALID_OBJECT = 1900;
1118: public const ERROR_INVALID_TIME = 1901;
1119: public const ERROR_INVALID_FORM_NAME = 1902;
1120: public const ERROR_INVALID_FORM_SIZE = 1903;
1121: public const ERROR_ALREADY_WAITING = 1904;
1122: public const ERROR_PRINTER_DELETED = 1905;
1123: public const ERROR_INVALID_PRINTER_STATE = 1906;
1124: public const ERROR_PASSWORD_MUST_CHANGE = 1907;
1125: public const ERROR_DOMAIN_CONTROLLER_NOT_FOUND = 1908;
1126: public const ERROR_ACCOUNT_LOCKED_OUT = 1909;
1127: public const OR_INVALID_OXID = 1910;
1128: public const OR_INVALID_OID = 1911;
1129: public const OR_INVALID_SET = 1912;
1130: public const RPC_S_SEND_INCOMPLETE = 1913;
1131: public const RPC_S_INVALID_ASYNC_HANDLE = 1914;
1132: public const RPC_S_INVALID_ASYNC_CALL = 1915;
1133: public const RPC_X_PIPE_CLOSED = 1916;
1134: public const RPC_X_PIPE_DISCIPLINE_ERROR = 1917;
1135: public const RPC_X_PIPE_EMPTY = 1918;
1136: public const ERROR_NO_SITENAME = 1919;
1137: public const ERROR_CANT_ACCESS_FILE = 1920;
1138: public const ERROR_CANT_RESOLVE_FILENAME = 1921;
1139: public const RPC_S_ENTRY_TYPE_MISMATCH = 1922;
1140: public const RPC_S_NOT_ALL_OBJS_EXPORTED = 1923;
1141: public const RPC_S_INTERFACE_NOT_EXPORTED = 1924;
1142: public const RPC_S_PROFILE_NOT_ADDED = 1925;
1143: public const RPC_S_PRF_ELT_NOT_ADDED = 1926;
1144: public const RPC_S_PRF_ELT_NOT_REMOVED = 1927;
1145: public const RPC_S_GRP_ELT_NOT_ADDED = 1928;
1146: public const RPC_S_GRP_ELT_NOT_REMOVED = 1929;
1147: public const ERROR_KM_DRIVER_BLOCKED = 1930;
1148: public const ERROR_CONTEXT_EXPIRED = 1931;
1149: public const ERROR_PER_USER_TRUST_QUOTA_EXCEEDED = 1932;
1150: public const ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED = 1933;
1151: public const ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED = 1934;
1152: public const ERROR_AUTHENTICATION_FIREWALL_FAILED = 1935;
1153: public const ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED = 1936;
1154: public const ERROR_NTLM_BLOCKED = 1937;
1155: public const ERROR_PASSWORD_CHANGE_REQUIRED = 1938;
1156: public const ERROR_INVALID_PIXEL_FORMAT = 2000;
1157: public const ERROR_BAD_DRIVER = 2001;
1158: public const ERROR_INVALID_WINDOW_STYLE = 2002;
1159: public const ERROR_METAFILE_NOT_SUPPORTED = 2003;
1160: public const ERROR_TRANSFORM_NOT_SUPPORTED = 2004;
1161: public const ERROR_CLIPPING_NOT_SUPPORTED = 2005;
1162: public const ERROR_INVALID_CMM = 2010;
1163: public const ERROR_INVALID_PROFILE = 2011;
1164: public const ERROR_TAG_NOT_FOUND = 2012;
1165: public const ERROR_TAG_NOT_PRESENT = 2013;
1166: public const ERROR_DUPLICATE_TAG = 2014;
1167: public const ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015;
1168: public const ERROR_PROFILE_NOT_FOUND = 2016;
1169: public const ERROR_INVALID_COLORSPACE = 2017;
1170: public const ERROR_ICM_NOT_ENABLED = 2018;
1171: public const ERROR_DELETING_ICM_XFORM = 2019;
1172: public const ERROR_INVALID_TRANSFORM = 2020;
1173: public const ERROR_COLORSPACE_MISMATCH = 2021;
1174: public const ERROR_INVALID_COLORINDEX = 2022;
1175: public const ERROR_PROFILE_DOES_NOT_MATCH_DEVICE = 2023;
1176: public const ERROR_CONNECTED_OTHER_PASSWORD = 2108;
1177: public const ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT = 2109;
1178: public const ERROR_BAD_USERNAME = 2202;
1179: public const ERROR_NOT_CONNECTED = 2250;
1180: public const ERROR_OPEN_FILES = 2401;
1181: public const ERROR_ACTIVE_CONNECTIONS = 2402;
1182: public const ERROR_DEVICE_IN_USE = 2404;
1183: public const ERROR_UNKNOWN_PRINT_MONITOR = 3000;
1184: public const ERROR_PRINTER_DRIVER_IN_USE = 3001;
1185: public const ERROR_SPOOL_FILE_NOT_FOUND = 3002;
1186: public const ERROR_SPL_NO_STARTDOC = 3003;
1187: public const ERROR_SPL_NO_ADDJOB = 3004;
1188: public const ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED = 3005;
1189: public const ERROR_PRINT_MONITOR_ALREADY_INSTALLED = 3006;
1190: public const ERROR_INVALID_PRINT_MONITOR = 3007;
1191: public const ERROR_PRINT_MONITOR_IN_USE = 3008;
1192: public const ERROR_PRINTER_HAS_JOBS_QUEUED = 3009;
1193: public const ERROR_SUCCESS_REBOOT_REQUIRED = 3010;
1194: public const ERROR_SUCCESS_RESTART_REQUIRED = 3011;
1195: public const ERROR_PRINTER_NOT_FOUND = 3012;
1196: public const ERROR_PRINTER_DRIVER_WARNED = 3013;
1197: public const ERROR_PRINTER_DRIVER_BLOCKED = 3014;
1198: public const ERROR_PRINTER_DRIVER_PACKAGE_IN_USE = 3015;
1199: public const ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND = 3016;
1200: public const ERROR_FAIL_REBOOT_REQUIRED = 3017;
1201: public const ERROR_FAIL_REBOOT_INITIATED = 3018;
1202: public const ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED = 3019;
1203: public const ERROR_PRINT_JOB_RESTART_REQUIRED = 3020;
1204: public const ERROR_INVALID_PRINTER_DRIVER_MANIFEST = 3021;
1205: public const ERROR_PRINTER_NOT_SHAREABLE = 3022;
1206: public const ERROR_REQUEST_PAUSED = 3050;
1207: public const ERROR_IO_REISSUE_AS_CACHED = 3950;
1208: public const ERROR_WINS_INTERNAL = 4000;
1209: public const ERROR_CAN_NOT_DEL_LOCAL_WINS = 4001;
1210: public const ERROR_STATIC_INIT = 4002;
1211: public const ERROR_INC_BACKUP = 4003;
1212: public const ERROR_FULL_BACKUP = 4004;
1213: public const ERROR_REC_NON_EXISTENT = 4005;
1214: public const ERROR_RPL_NOT_ALLOWED = 4006;
1215: public const PEERDIST_ERROR_CONTENTINFO_VERSION_UNSUPPORTED = 4050;
1216: public const PEERDIST_ERROR_CANNOT_PARSE_CONTENTINFO = 4051;
1217: public const PEERDIST_ERROR_MISSING_DATA = 4052;
1218: public const PEERDIST_ERROR_NO_MORE = 4053;
1219: public const PEERDIST_ERROR_NOT_INITIALIZED = 4054;
1220: public const PEERDIST_ERROR_ALREADY_INITIALIZED = 4055;
1221: public const PEERDIST_ERROR_SHUTDOWN_IN_PROGRESS = 4056;
1222: public const PEERDIST_ERROR_INVALIDATED = 4057;
1223: public const PEERDIST_ERROR_ALREADY_EXISTS = 4058;
1224: public const PEERDIST_ERROR_OPERATION_NOTFOUND = 4059;
1225: public const PEERDIST_ERROR_ALREADY_COMPLETED = 4060;
1226: public const PEERDIST_ERROR_OUT_OF_BOUNDS = 4061;
1227: public const PEERDIST_ERROR_VERSION_UNSUPPORTED = 4062;
1228: public const PEERDIST_ERROR_INVALID_CONFIGURATION = 4063;
1229: public const PEERDIST_ERROR_NOT_LICENSED = 4064;
1230: public const PEERDIST_ERROR_SERVICE_UNAVAILABLE = 4065;
1231: public const PEERDIST_ERROR_TRUST_FAILURE = 4066;
1232: public const ERROR_DHCP_ADDRESS_CONFLICT = 4100;
1233: public const ERROR_WMI_GUID_NOT_FOUND = 4200;
1234: public const ERROR_WMI_INSTANCE_NOT_FOUND = 4201;
1235: public const ERROR_WMI_ITEMID_NOT_FOUND = 4202;
1236: public const ERROR_WMI_TRY_AGAIN = 4203;
1237: public const ERROR_WMI_DP_NOT_FOUND = 4204;
1238: public const ERROR_WMI_UNRESOLVED_INSTANCE_REF = 4205;
1239: public const ERROR_WMI_ALREADY_ENABLED = 4206;
1240: public const ERROR_WMI_GUID_DISCONNECTED = 4207;
1241: public const ERROR_WMI_SERVER_UNAVAILABLE = 4208;
1242: public const ERROR_WMI_DP_FAILED = 4209;
1243: public const ERROR_WMI_INVALID_MOF = 4210;
1244: public const ERROR_WMI_INVALID_REGINFO = 4211;
1245: public const ERROR_WMI_ALREADY_DISABLED = 4212;
1246: public const ERROR_WMI_READ_ONLY = 4213;
1247: public const ERROR_WMI_SET_FAILURE = 4214;
1248: public const ERROR_NOT_APPCONTAINER = 4250;
1249: public const ERROR_APPCONTAINER_REQUIRED = 4251;
1250: public const ERROR_NOT_SUPPORTED_IN_APPCONTAINER = 4252;
1251: public const ERROR_INVALID_PACKAGE_SID_LENGTH = 4253;
1252: public const ERROR_INVALID_MEDIA = 4300;
1253: public const ERROR_INVALID_LIBRARY = 4301;
1254: public const ERROR_INVALID_MEDIA_POOL = 4302;
1255: public const ERROR_DRIVE_MEDIA_MISMATCH = 4303;
1256: public const ERROR_MEDIA_OFFLINE = 4304;
1257: public const ERROR_LIBRARY_OFFLINE = 4305;
1258: public const ERROR_EMPTY = 4306;
1259: public const ERROR_NOT_EMPTY = 4307;
1260: public const ERROR_MEDIA_UNAVAILABLE = 4308;
1261: public const ERROR_RESOURCE_DISABLED = 4309;
1262: public const ERROR_INVALID_CLEANER = 4310;
1263: public const ERROR_UNABLE_TO_CLEAN = 4311;
1264: public const ERROR_OBJECT_NOT_FOUND = 4312;
1265: public const ERROR_DATABASE_FAILURE = 4313;
1266: public const ERROR_DATABASE_FULL = 4314;
1267: public const ERROR_MEDIA_INCOMPATIBLE = 4315;
1268: public const ERROR_RESOURCE_NOT_PRESENT = 4316;
1269: public const ERROR_INVALID_OPERATION = 4317;
1270: public const ERROR_MEDIA_NOT_AVAILABLE = 4318;
1271: public const ERROR_DEVICE_NOT_AVAILABLE = 4319;
1272: public const ERROR_REQUEST_REFUSED = 4320;
1273: public const ERROR_INVALID_DRIVE_OBJECT = 4321;
1274: public const ERROR_LIBRARY_FULL = 4322;
1275: public const ERROR_MEDIUM_NOT_ACCESSIBLE = 4323;
1276: public const ERROR_UNABLE_TO_LOAD_MEDIUM = 4324;
1277: public const ERROR_UNABLE_TO_INVENTORY_DRIVE = 4325;
1278: public const ERROR_UNABLE_TO_INVENTORY_SLOT = 4326;
1279: public const ERROR_UNABLE_TO_INVENTORY_TRANSPORT = 4327;
1280: public const ERROR_TRANSPORT_FULL = 4328;
1281: public const ERROR_CONTROLLING_IEPORT = 4329;
1282: public const ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA = 4330;
1283: public const ERROR_CLEANER_SLOT_SET = 4331;
1284: public const ERROR_CLEANER_SLOT_NOT_SET = 4332;
1285: public const ERROR_CLEANER_CARTRIDGE_SPENT = 4333;
1286: public const ERROR_UNEXPECTED_OMID = 4334;
1287: public const ERROR_CANT_DELETE_LAST_ITEM = 4335;
1288: public const ERROR_MESSAGE_EXCEEDS_MAX_SIZE = 4336;
1289: public const ERROR_VOLUME_CONTAINS_SYS_FILES = 4337;
1290: public const ERROR_INDIGENOUS_TYPE = 4338;
1291: public const ERROR_NO_SUPPORTING_DRIVES = 4339;
1292: public const ERROR_CLEANER_CARTRIDGE_INSTALLED = 4340;
1293: public const ERROR_IEPORT_FULL = 4341;
1294: public const ERROR_FILE_OFFLINE = 4350;
1295: public const ERROR_REMOTE_STORAGE_NOT_ACTIVE = 4351;
1296: public const ERROR_REMOTE_STORAGE_MEDIA_ERROR = 4352;
1297: public const ERROR_NOT_A_REPARSE_POINT = 4390;
1298: public const ERROR_REPARSE_ATTRIBUTE_CONFLICT = 4391;
1299: public const ERROR_INVALID_REPARSE_DATA = 4392;
1300: public const ERROR_REPARSE_TAG_INVALID = 4393;
1301: public const ERROR_REPARSE_TAG_MISMATCH = 4394;
1302: public const ERROR_APP_DATA_NOT_FOUND = 4400;
1303: public const ERROR_APP_DATA_EXPIRED = 4401;
1304: public const ERROR_APP_DATA_CORRUPT = 4402;
1305: public const ERROR_APP_DATA_LIMIT_EXCEEDED = 4403;
1306: public const ERROR_APP_DATA_REBOOT_REQUIRED = 4404;
1307: public const ERROR_SECUREBOOT_ROLLBACK_DETECTED = 4420;
1308: public const ERROR_SECUREBOOT_POLICY_VIOLATION = 4421;
1309: public const ERROR_SECUREBOOT_INVALID_POLICY = 4422;
1310: public const ERROR_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND = 4423;
1311: public const ERROR_SECUREBOOT_POLICY_NOT_SIGNED = 4424;
1312: public const ERROR_SECUREBOOT_NOT_ENABLED = 4425;
1313: public const ERROR_SECUREBOOT_FILE_REPLACED = 4426;
1314: public const ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED = 4440;
1315: public const ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED = 4441;
1316: public const ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED = 4442;
1317: public const ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED = 4443;
1318: public const ERROR_VOLUME_NOT_SIS_ENABLED = 4500;
1319: public const ERROR_DEPENDENT_RESOURCE_EXISTS = 5001;
1320: public const ERROR_DEPENDENCY_NOT_FOUND = 5002;
1321: public const ERROR_DEPENDENCY_ALREADY_EXISTS = 5003;
1322: public const ERROR_RESOURCE_NOT_ONLINE = 5004;
1323: public const ERROR_HOST_NODE_NOT_AVAILABLE = 5005;
1324: public const ERROR_RESOURCE_NOT_AVAILABLE = 5006;
1325: public const ERROR_RESOURCE_NOT_FOUND = 5007;
1326: public const ERROR_SHUTDOWN_CLUSTER = 5008;
1327: public const ERROR_CANT_EVICT_ACTIVE_NODE = 5009;
1328: public const ERROR_OBJECT_ALREADY_EXISTS = 5010;
1329: public const ERROR_OBJECT_IN_LIST = 5011;
1330: public const ERROR_GROUP_NOT_AVAILABLE = 5012;
1331: public const ERROR_GROUP_NOT_FOUND = 5013;
1332: public const ERROR_GROUP_NOT_ONLINE = 5014;
1333: public const ERROR_HOST_NODE_NOT_RESOURCE_OWNER = 5015;
1334: public const ERROR_HOST_NODE_NOT_GROUP_OWNER = 5016;
1335: public const ERROR_RESMON_CREATE_FAILED = 5017;
1336: public const ERROR_RESMON_ONLINE_FAILED = 5018;
1337: public const ERROR_RESOURCE_ONLINE = 5019;
1338: public const ERROR_QUORUM_RESOURCE = 5020;
1339: public const ERROR_NOT_QUORUM_CAPABLE = 5021;
1340: public const ERROR_CLUSTER_SHUTTING_DOWN = 5022;
1341: public const ERROR_INVALID_STATE = 5023;
1342: public const ERROR_RESOURCE_PROPERTIES_STORED = 5024;
1343: public const ERROR_NOT_QUORUM_CLASS = 5025;
1344: public const ERROR_CORE_RESOURCE = 5026;
1345: public const ERROR_QUORUM_RESOURCE_ONLINE_FAILED = 5027;
1346: public const ERROR_QUORUMLOG_OPEN_FAILED = 5028;
1347: public const ERROR_CLUSTERLOG_CORRUPT = 5029;
1348: public const ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE = 5030;
1349: public const ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE = 5031;
1350: public const ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND = 5032;
1351: public const ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE = 5033;
1352: public const ERROR_QUORUM_OWNER_ALIVE = 5034;
1353: public const ERROR_NETWORK_NOT_AVAILABLE = 5035;
1354: public const ERROR_NODE_NOT_AVAILABLE = 5036;
1355: public const ERROR_ALL_NODES_NOT_AVAILABLE = 5037;
1356: public const ERROR_RESOURCE_FAILED = 5038;
1357: public const ERROR_CLUSTER_INVALID_NODE = 5039;
1358: public const ERROR_CLUSTER_NODE_EXISTS = 5040;
1359: public const ERROR_CLUSTER_JOIN_IN_PROGRESS = 5041;
1360: public const ERROR_CLUSTER_NODE_NOT_FOUND = 5042;
1361: public const ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND = 5043;
1362: public const ERROR_CLUSTER_NETWORK_EXISTS = 5044;
1363: public const ERROR_CLUSTER_NETWORK_NOT_FOUND = 5045;
1364: public const ERROR_CLUSTER_NETINTERFACE_EXISTS = 5046;
1365: public const ERROR_CLUSTER_NETINTERFACE_NOT_FOUND = 5047;
1366: public const ERROR_CLUSTER_INVALID_REQUEST = 5048;
1367: public const ERROR_CLUSTER_INVALID_NETWORK_PROVIDER = 5049;
1368: public const ERROR_CLUSTER_NODE_DOWN = 5050;
1369: public const ERROR_CLUSTER_NODE_UNREACHABLE = 5051;
1370: public const ERROR_CLUSTER_NODE_NOT_MEMBER = 5052;
1371: public const ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS = 5053;
1372: public const ERROR_CLUSTER_INVALID_NETWORK = 5054;
1373: public const ERROR_CLUSTER_NODE_UP = 5056;
1374: public const ERROR_CLUSTER_IPADDR_IN_USE = 5057;
1375: public const ERROR_CLUSTER_NODE_NOT_PAUSED = 5058;
1376: public const ERROR_CLUSTER_NO_SECURITY_CONTEXT = 5059;
1377: public const ERROR_CLUSTER_NETWORK_NOT_INTERNAL = 5060;
1378: public const ERROR_CLUSTER_NODE_ALREADY_UP = 5061;
1379: public const ERROR_CLUSTER_NODE_ALREADY_DOWN = 5062;
1380: public const ERROR_CLUSTER_NETWORK_ALREADY_ONLINE = 5063;
1381: public const ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE = 5064;
1382: public const ERROR_CLUSTER_NODE_ALREADY_MEMBER = 5065;
1383: public const ERROR_CLUSTER_LAST_INTERNAL_NETWORK = 5066;
1384: public const ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS = 5067;
1385: public const ERROR_INVALID_OPERATION_ON_QUORUM = 5068;
1386: public const ERROR_DEPENDENCY_NOT_ALLOWED = 5069;
1387: public const ERROR_CLUSTER_NODE_PAUSED = 5070;
1388: public const ERROR_NODE_CANT_HOST_RESOURCE = 5071;
1389: public const ERROR_CLUSTER_NODE_NOT_READY = 5072;
1390: public const ERROR_CLUSTER_NODE_SHUTTING_DOWN = 5073;
1391: public const ERROR_CLUSTER_JOIN_ABORTED = 5074;
1392: public const ERROR_CLUSTER_INCOMPATIBLE_VERSIONS = 5075;
1393: public const ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED = 5076;
1394: public const ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED = 5077;
1395: public const ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND = 5078;
1396: public const ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED = 5079;
1397: public const ERROR_CLUSTER_RESNAME_NOT_FOUND = 5080;
1398: public const ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED = 5081;
1399: public const ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST = 5082;
1400: public const ERROR_CLUSTER_DATABASE_SEQMISMATCH = 5083;
1401: public const ERROR_RESMON_INVALID_STATE = 5084;
1402: public const ERROR_CLUSTER_GUM_NOT_LOCKER = 5085;
1403: public const ERROR_QUORUM_DISK_NOT_FOUND = 5086;
1404: public const ERROR_DATABASE_BACKUP_CORRUPT = 5087;
1405: public const ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT = 5088;
1406: public const ERROR_RESOURCE_PROPERTY_UNCHANGEABLE = 5089;
1407: public const ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE = 5890;
1408: public const ERROR_CLUSTER_QUORUMLOG_NOT_FOUND = 5891;
1409: public const ERROR_CLUSTER_MEMBERSHIP_HALT = 5892;
1410: public const ERROR_CLUSTER_INSTANCE_ID_MISMATCH = 5893;
1411: public const ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP = 5894;
1412: public const ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH = 5895;
1413: public const ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP = 5896;
1414: public const ERROR_CLUSTER_PARAMETER_MISMATCH = 5897;
1415: public const ERROR_NODE_CANNOT_BE_CLUSTERED = 5898;
1416: public const ERROR_CLUSTER_WRONG_OS_VERSION = 5899;
1417: public const ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME = 5900;
1418: public const ERROR_CLUSCFG_ALREADY_COMMITTED = 5901;
1419: public const ERROR_CLUSCFG_ROLLBACK_FAILED = 5902;
1420: public const ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT = 5903;
1421: public const ERROR_CLUSTER_OLD_VERSION = 5904;
1422: public const ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME = 5905;
1423: public const ERROR_CLUSTER_NO_NET_ADAPTERS = 5906;
1424: public const ERROR_CLUSTER_POISONED = 5907;
1425: public const ERROR_CLUSTER_GROUP_MOVING = 5908;
1426: public const ERROR_CLUSTER_RESOURCE_TYPE_BUSY = 5909;
1427: public const ERROR_RESOURCE_CALL_TIMED_OUT = 5910;
1428: public const ERROR_INVALID_CLUSTER_IPV6_ADDRESS = 5911;
1429: public const ERROR_CLUSTER_INTERNAL_INVALID_FUNCTION = 5912;
1430: public const ERROR_CLUSTER_PARAMETER_OUT_OF_BOUNDS = 5913;
1431: public const ERROR_CLUSTER_PARTIAL_SEND = 5914;
1432: public const ERROR_CLUSTER_REGISTRY_INVALID_FUNCTION = 5915;
1433: public const ERROR_CLUSTER_INVALID_STRING_TERMINATION = 5916;
1434: public const ERROR_CLUSTER_INVALID_STRING_FORMAT = 5917;
1435: public const ERROR_CLUSTER_DATABASE_TRANSACTION_IN_PROGRESS = 5918;
1436: public const ERROR_CLUSTER_DATABASE_TRANSACTION_NOT_IN_PROGRESS = 5919;
1437: public const ERROR_CLUSTER_NULL_DATA = 5920;
1438: public const ERROR_CLUSTER_PARTIAL_READ = 5921;
1439: public const ERROR_CLUSTER_PARTIAL_WRITE = 5922;
1440: public const ERROR_CLUSTER_CANT_DESERIALIZE_DATA = 5923;
1441: public const ERROR_DEPENDENT_RESOURCE_PROPERTY_CONFLICT = 5924;
1442: public const ERROR_CLUSTER_NO_QUORUM = 5925;
1443: public const ERROR_CLUSTER_INVALID_IPV6_NETWORK = 5926;
1444: public const ERROR_CLUSTER_INVALID_IPV6_TUNNEL_NETWORK = 5927;
1445: public const ERROR_QUORUM_NOT_ALLOWED_IN_THIS_GROUP = 5928;
1446: public const ERROR_DEPENDENCY_TREE_TOO_COMPLEX = 5929;
1447: public const ERROR_EXCEPTION_IN_RESOURCE_CALL = 5930;
1448: public const ERROR_CLUSTER_RHS_FAILED_INITIALIZATION = 5931;
1449: public const ERROR_CLUSTER_NOT_INSTALLED = 5932;
1450: public const ERROR_CLUSTER_RESOURCES_MUST_BE_ONLINE_ON_THE_SAME_NODE = 5933;
1451: public const ERROR_CLUSTER_MAX_NODES_IN_CLUSTER = 5934;
1452: public const ERROR_CLUSTER_TOO_MANY_NODES = 5935;
1453: public const ERROR_CLUSTER_OBJECT_ALREADY_USED = 5936;
1454: public const ERROR_NONCORE_GROUPS_FOUND = 5937;
1455: public const ERROR_FILE_SHARE_RESOURCE_CONFLICT = 5938;
1456: public const ERROR_CLUSTER_EVICT_INVALID_REQUEST = 5939;
1457: public const ERROR_CLUSTER_SINGLETON_RESOURCE = 5940;
1458: public const ERROR_CLUSTER_GROUP_SINGLETON_RESOURCE = 5941;
1459: public const ERROR_CLUSTER_RESOURCE_PROVIDER_FAILED = 5942;
1460: public const ERROR_CLUSTER_RESOURCE_CONFIGURATION_ERROR = 5943;
1461: public const ERROR_CLUSTER_GROUP_BUSY = 5944;
1462: public const ERROR_CLUSTER_NOT_SHARED_VOLUME = 5945;
1463: public const ERROR_CLUSTER_INVALID_SECURITY_DESCRIPTOR = 5946;
1464: public const ERROR_CLUSTER_SHARED_VOLUMES_IN_USE = 5947;
1465: public const ERROR_CLUSTER_USE_SHARED_VOLUMES_API = 5948;
1466: public const ERROR_CLUSTER_BACKUP_IN_PROGRESS = 5949;
1467: public const ERROR_NON_CSV_PATH = 5950;
1468: public const ERROR_CSV_VOLUME_NOT_LOCAL = 5951;
1469: public const ERROR_CLUSTER_WATCHDOG_TERMINATING = 5952;
1470: public const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_INCOMPATIBLE_NODES = 5953;
1471: public const ERROR_CLUSTER_INVALID_NODE_WEIGHT = 5954;
1472: public const ERROR_CLUSTER_RESOURCE_VETOED_CALL = 5955;
1473: public const ERROR_RESMON_SYSTEM_RESOURCES_LACKING = 5956;
1474: public const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_DESTINATION = 5957;
1475: public const ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_SOURCE = 5958;
1476: public const ERROR_CLUSTER_GROUP_QUEUED = 5959;
1477: public const ERROR_CLUSTER_RESOURCE_LOCKED_STATUS = 5960;
1478: public const ERROR_CLUSTER_SHARED_VOLUME_FAILOVER_NOT_ALLOWED = 5961;
1479: public const ERROR_CLUSTER_NODE_DRAIN_IN_PROGRESS = 5962;
1480: public const ERROR_CLUSTER_DISK_NOT_CONNECTED = 5963;
1481: public const ERROR_DISK_NOT_CSV_CAPABLE = 5964;
1482: public const ERROR_RESOURCE_NOT_IN_AVAILABLE_STORAGE = 5965;
1483: public const ERROR_CLUSTER_SHARED_VOLUME_REDIRECTED = 5966;
1484: public const ERROR_CLUSTER_SHARED_VOLUME_NOT_REDIRECTED = 5967;
1485: public const ERROR_CLUSTER_CANNOT_RETURN_PROPERTIES = 5968;
1486: public const ERROR_CLUSTER_RESOURCE_CONTAINS_UNSUPPORTED_DIFF_AREA_FOR_SHARED_VOLUMES = 5969;
1487: public const ERROR_CLUSTER_RESOURCE_IS_IN_MAINTENANCE_MODE = 5970;
1488: public const ERROR_CLUSTER_AFFINITY_CONFLICT = 5971;
1489: public const ERROR_CLUSTER_RESOURCE_IS_REPLICA_VIRTUAL_MACHINE = 5972;
1490: public const ERROR_ENCRYPTION_FAILED = 6000;
1491: public const ERROR_DECRYPTION_FAILED = 6001;
1492: public const ERROR_FILE_ENCRYPTED = 6002;
1493: public const ERROR_NO_RECOVERY_POLICY = 6003;
1494: public const ERROR_NO_EFS = 6004;
1495: public const ERROR_WRONG_EFS = 6005;
1496: public const ERROR_NO_USER_KEYS = 6006;
1497: public const ERROR_FILE_NOT_ENCRYPTED = 6007;
1498: public const ERROR_NOT_EXPORT_FORMAT = 6008;
1499: public const ERROR_FILE_READ_ONLY = 6009;
1500: public const ERROR_DIR_EFS_DISALLOWED = 6010;
1501: public const ERROR_EFS_SERVER_NOT_TRUSTED = 6011;
1502: public const ERROR_BAD_RECOVERY_POLICY = 6012;
1503: public const ERROR_EFS_ALG_BLOB_TOO_BIG = 6013;
1504: public const ERROR_VOLUME_NOT_SUPPORT_EFS = 6014;
1505: public const ERROR_EFS_DISABLED = 6015;
1506: public const ERROR_EFS_VERSION_NOT_SUPPORT = 6016;
1507: public const ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE = 6017;
1508: public const ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER = 6018;
1509: public const ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE = 6019;
1510: public const ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE = 6020;
1511: public const ERROR_CS_ENCRYPTION_FILE_NOT_CSE = 6021;
1512: public const ERROR_ENCRYPTION_POLICY_DENIES_OPERATION = 6022;
1513: public const ERROR_NO_BROWSER_SERVERS_FOUND = 6118;
1514: public const SCHED_E_SERVICE_NOT_LOCALSYSTEM = 6200;
1515: public const ERROR_LOG_SECTOR_INVALID = 6600;
1516: public const ERROR_LOG_SECTOR_PARITY_INVALID = 6601;
1517: public const ERROR_LOG_SECTOR_REMAPPED = 6602;
1518: public const ERROR_LOG_BLOCK_INCOMPLETE = 6603;
1519: public const ERROR_LOG_INVALID_RANGE = 6604;
1520: public const ERROR_LOG_BLOCKS_EXHAUSTED = 6605;
1521: public const ERROR_LOG_READ_CONTEXT_INVALID = 6606;
1522: public const ERROR_LOG_RESTART_INVALID = 6607;
1523: public const ERROR_LOG_BLOCK_VERSION = 6608;
1524: public const ERROR_LOG_BLOCK_INVALID = 6609;
1525: public const ERROR_LOG_READ_MODE_INVALID = 6610;
1526: public const ERROR_LOG_NO_RESTART = 6611;
1527: public const ERROR_LOG_METADATA_CORRUPT = 6612;
1528: public const ERROR_LOG_METADATA_INVALID = 6613;
1529: public const ERROR_LOG_METADATA_INCONSISTENT = 6614;
1530: public const ERROR_LOG_RESERVATION_INVALID = 6615;
1531: public const ERROR_LOG_CANT_DELETE = 6616;
1532: public const ERROR_LOG_CONTAINER_LIMIT_EXCEEDED = 6617;
1533: public const ERROR_LOG_START_OF_LOG = 6618;
1534: public const ERROR_LOG_POLICY_ALREADY_INSTALLED = 6619;
1535: public const ERROR_LOG_POLICY_NOT_INSTALLED = 6620;
1536: public const ERROR_LOG_POLICY_INVALID = 6621;
1537: public const ERROR_LOG_POLICY_CONFLICT = 6622;
1538: public const ERROR_LOG_PINNED_ARCHIVE_TAIL = 6623;
1539: public const ERROR_LOG_RECORD_NONEXISTENT = 6624;
1540: public const ERROR_LOG_RECORDS_RESERVED_INVALID = 6625;
1541: public const ERROR_LOG_SPACE_RESERVED_INVALID = 6626;
1542: public const ERROR_LOG_TAIL_INVALID = 6627;
1543: public const ERROR_LOG_FULL = 6628;
1544: public const ERROR_COULD_NOT_RESIZE_LOG = 6629;
1545: public const ERROR_LOG_MULTIPLEXED = 6630;
1546: public const ERROR_LOG_DEDICATED = 6631;
1547: public const ERROR_LOG_ARCHIVE_NOT_IN_PROGRESS = 6632;
1548: public const ERROR_LOG_ARCHIVE_IN_PROGRESS = 6633;
1549: public const ERROR_LOG_EPHEMERAL = 6634;
1550: public const ERROR_LOG_NOT_ENOUGH_CONTAINERS = 6635;
1551: public const ERROR_LOG_CLIENT_ALREADY_REGISTERED = 6636;
1552: public const ERROR_LOG_CLIENT_NOT_REGISTERED = 6637;
1553: public const ERROR_LOG_FULL_HANDLER_IN_PROGRESS = 6638;
1554: public const ERROR_LOG_CONTAINER_READ_FAILED = 6639;
1555: public const ERROR_LOG_CONTAINER_WRITE_FAILED = 6640;
1556: public const ERROR_LOG_CONTAINER_OPEN_FAILED = 6641;
1557: public const ERROR_LOG_CONTAINER_STATE_INVALID = 6642;
1558: public const ERROR_LOG_STATE_INVALID = 6643;
1559: public const ERROR_LOG_PINNED = 6644;
1560: public const ERROR_LOG_METADATA_FLUSH_FAILED = 6645;
1561: public const ERROR_LOG_INCONSISTENT_SECURITY = 6646;
1562: public const ERROR_LOG_APPENDED_FLUSH_FAILED = 6647;
1563: public const ERROR_LOG_PINNED_RESERVATION = 6648;
1564: public const ERROR_INVALID_TRANSACTION = 6700;
1565: public const ERROR_TRANSACTION_NOT_ACTIVE = 6701;
1566: public const ERROR_TRANSACTION_REQUEST_NOT_VALID = 6702;
1567: public const ERROR_TRANSACTION_NOT_REQUESTED = 6703;
1568: public const ERROR_TRANSACTION_ALREADY_ABORTED = 6704;
1569: public const ERROR_TRANSACTION_ALREADY_COMMITTED = 6705;
1570: public const ERROR_TM_INITIALIZATION_FAILED = 6706;
1571: public const ERROR_RESOURCEMANAGER_READ_ONLY = 6707;
1572: public const ERROR_TRANSACTION_NOT_JOINED = 6708;
1573: public const ERROR_TRANSACTION_SUPERIOR_EXISTS = 6709;
1574: public const ERROR_CRM_PROTOCOL_ALREADY_EXISTS = 6710;
1575: public const ERROR_TRANSACTION_PROPAGATION_FAILED = 6711;
1576: public const ERROR_CRM_PROTOCOL_NOT_FOUND = 6712;
1577: public const ERROR_TRANSACTION_INVALID_MARSHALL_BUFFER = 6713;
1578: public const ERROR_CURRENT_TRANSACTION_NOT_VALID = 6714;
1579: public const ERROR_TRANSACTION_NOT_FOUND = 6715;
1580: public const ERROR_RESOURCEMANAGER_NOT_FOUND = 6716;
1581: public const ERROR_ENLISTMENT_NOT_FOUND = 6717;
1582: public const ERROR_TRANSACTIONMANAGER_NOT_FOUND = 6718;
1583: public const ERROR_TRANSACTIONMANAGER_NOT_ONLINE = 6719;
1584: public const ERROR_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION = 6720;
1585: public const ERROR_TRANSACTION_NOT_ROOT = 6721;
1586: public const ERROR_TRANSACTION_OBJECT_EXPIRED = 6722;
1587: public const ERROR_TRANSACTION_RESPONSE_NOT_ENLISTED = 6723;
1588: public const ERROR_TRANSACTION_RECORD_TOO_LONG = 6724;
1589: public const ERROR_IMPLICIT_TRANSACTION_NOT_SUPPORTED = 6725;
1590: public const ERROR_TRANSACTION_INTEGRITY_VIOLATED = 6726;
1591: public const ERROR_TRANSACTIONMANAGER_IDENTITY_MISMATCH = 6727;
1592: public const ERROR_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT = 6728;
1593: public const ERROR_TRANSACTION_MUST_WRITETHROUGH = 6729;
1594: public const ERROR_TRANSACTION_NO_SUPERIOR = 6730;
1595: public const ERROR_HEURISTIC_DAMAGE_POSSIBLE = 6731;
1596: public const ERROR_TRANSACTIONAL_CONFLICT = 6800;
1597: public const ERROR_RM_NOT_ACTIVE = 6801;
1598: public const ERROR_RM_METADATA_CORRUPT = 6802;
1599: public const ERROR_DIRECTORY_NOT_RM = 6803;
1600: public const ERROR_TRANSACTIONS_UNSUPPORTED_REMOTE = 6805;
1601: public const ERROR_LOG_RESIZE_INVALID_SIZE = 6806;
1602: public const ERROR_OBJECT_NO_LONGER_EXISTS = 6807;
1603: public const ERROR_STREAM_MINIVERSION_NOT_FOUND = 6808;
1604: public const ERROR_STREAM_MINIVERSION_NOT_VALID = 6809;
1605: public const ERROR_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION = 6810;
1606: public const ERROR_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT = 6811;
1607: public const ERROR_CANT_CREATE_MORE_STREAM_MINIVERSIONS = 6812;
1608: public const ERROR_REMOTE_FILE_VERSION_MISMATCH = 6814;
1609: public const ERROR_HANDLE_NO_LONGER_VALID = 6815;
1610: public const ERROR_NO_TXF_METADATA = 6816;
1611: public const ERROR_LOG_CORRUPTION_DETECTED = 6817;
1612: public const ERROR_CANT_RECOVER_WITH_HANDLE_OPEN = 6818;
1613: public const ERROR_RM_DISCONNECTED = 6819;
1614: public const ERROR_ENLISTMENT_NOT_SUPERIOR = 6820;
1615: public const ERROR_RECOVERY_NOT_NEEDED = 6821;
1616: public const ERROR_RM_ALREADY_STARTED = 6822;
1617: public const ERROR_FILE_IDENTITY_NOT_PERSISTENT = 6823;
1618: public const ERROR_CANT_BREAK_TRANSACTIONAL_DEPENDENCY = 6824;
1619: public const ERROR_CANT_CROSS_RM_BOUNDARY = 6825;
1620: public const ERROR_TXF_DIR_NOT_EMPTY = 6826;
1621: public const ERROR_INDOUBT_TRANSACTIONS_EXIST = 6827;
1622: public const ERROR_TM_VOLATILE = 6828;
1623: public const ERROR_ROLLBACK_TIMER_EXPIRED = 6829;
1624: public const ERROR_TXF_ATTRIBUTE_CORRUPT = 6830;
1625: public const ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION = 6831;
1626: public const ERROR_TRANSACTIONAL_OPEN_NOT_ALLOWED = 6832;
1627: public const ERROR_LOG_GROWTH_FAILED = 6833;
1628: public const ERROR_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE = 6834;
1629: public const ERROR_TXF_METADATA_ALREADY_PRESENT = 6835;
1630: public const ERROR_TRANSACTION_SCOPE_CALLBACKS_NOT_SET = 6836;
1631: public const ERROR_TRANSACTION_REQUIRED_PROMOTION = 6837;
1632: public const ERROR_CANNOT_EXECUTE_FILE_IN_TRANSACTION = 6838;
1633: public const ERROR_TRANSACTIONS_NOT_FROZEN = 6839;
1634: public const ERROR_TRANSACTION_FREEZE_IN_PROGRESS = 6840;
1635: public const ERROR_NOT_SNAPSHOT_VOLUME = 6841;
1636: public const ERROR_NO_SAVEPOINT_WITH_OPEN_FILES = 6842;
1637: public const ERROR_DATA_LOST_REPAIR = 6843;
1638: public const ERROR_SPARSE_NOT_ALLOWED_IN_TRANSACTION = 6844;
1639: public const ERROR_TM_IDENTITY_MISMATCH = 6845;
1640: public const ERROR_FLOATED_SECTION = 6846;
1641: public const ERROR_CANNOT_ACCEPT_TRANSACTED_WORK = 6847;
1642: public const ERROR_CANNOT_ABORT_TRANSACTIONS = 6848;
1643: public const ERROR_BAD_CLUSTERS = 6849;
1644: public const ERROR_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION = 6850;
1645: public const ERROR_VOLUME_DIRTY = 6851;
1646: public const ERROR_NO_LINK_TRACKING_IN_TRANSACTION = 6852;
1647: public const ERROR_OPERATION_NOT_SUPPORTED_IN_TRANSACTION = 6853;
1648: public const ERROR_EXPIRED_HANDLE = 6854;
1649: public const ERROR_TRANSACTION_NOT_ENLISTED = 6855;
1650: public const ERROR_CTX_WINSTATION_NAME_INVALID = 7001;
1651: public const ERROR_CTX_INVALID_PD = 7002;
1652: public const ERROR_CTX_PD_NOT_FOUND = 7003;
1653: public const ERROR_CTX_WD_NOT_FOUND = 7004;
1654: public const ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY = 7005;
1655: public const ERROR_CTX_SERVICE_NAME_COLLISION = 7006;
1656: public const ERROR_CTX_CLOSE_PENDING = 7007;
1657: public const ERROR_CTX_NO_OUTBUF = 7008;
1658: public const ERROR_CTX_MODEM_INF_NOT_FOUND = 7009;
1659: public const ERROR_CTX_INVALID_MODEMNAME = 7010;
1660: public const ERROR_CTX_MODEM_RESPONSE_ERROR = 7011;
1661: public const ERROR_CTX_MODEM_RESPONSE_TIMEOUT = 7012;
1662: public const ERROR_CTX_MODEM_RESPONSE_NO_CARRIER = 7013;
1663: public const ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE = 7014;
1664: public const ERROR_CTX_MODEM_RESPONSE_BUSY = 7015;
1665: public const ERROR_CTX_MODEM_RESPONSE_VOICE = 7016;
1666: public const ERROR_CTX_TD_ERROR = 7017;
1667: public const ERROR_CTX_WINSTATION_NOT_FOUND = 7022;
1668: public const ERROR_CTX_WINSTATION_ALREADY_EXISTS = 7023;
1669: public const ERROR_CTX_WINSTATION_BUSY = 7024;
1670: public const ERROR_CTX_BAD_VIDEO_MODE = 7025;
1671: public const ERROR_CTX_GRAPHICS_INVALID = 7035;
1672: public const ERROR_CTX_LOGON_DISABLED = 7037;
1673: public const ERROR_CTX_NOT_CONSOLE = 7038;
1674: public const ERROR_CTX_CLIENT_QUERY_TIMEOUT = 7040;
1675: public const ERROR_CTX_CONSOLE_DISCONNECT = 7041;
1676: public const ERROR_CTX_CONSOLE_CONNECT = 7042;
1677: public const ERROR_CTX_SHADOW_DENIED = 7044;
1678: public const ERROR_CTX_WINSTATION_ACCESS_DENIED = 7045;
1679: public const ERROR_CTX_INVALID_WD = 7049;
1680: public const ERROR_CTX_SHADOW_INVALID = 7050;
1681: public const ERROR_CTX_SHADOW_DISABLED = 7051;
1682: public const ERROR_CTX_CLIENT_LICENSE_IN_USE = 7052;
1683: public const ERROR_CTX_CLIENT_LICENSE_NOT_SET = 7053;
1684: public const ERROR_CTX_LICENSE_NOT_AVAILABLE = 7054;
1685: public const ERROR_CTX_LICENSE_CLIENT_INVALID = 7055;
1686: public const ERROR_CTX_LICENSE_EXPIRED = 7056;
1687: public const ERROR_CTX_SHADOW_NOT_RUNNING = 7057;
1688: public const ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE = 7058;
1689: public const ERROR_ACTIVATION_COUNT_EXCEEDED = 7059;
1690: public const ERROR_CTX_WINSTATIONS_DISABLED = 7060;
1691: public const ERROR_CTX_ENCRYPTION_LEVEL_REQUIRED = 7061;
1692: public const ERROR_CTX_SESSION_IN_USE = 7062;
1693: public const ERROR_CTX_NO_FORCE_LOGOFF = 7063;
1694: public const ERROR_CTX_ACCOUNT_RESTRICTION = 7064;
1695: public const ERROR_RDP_PROTOCOL_ERROR = 7065;
1696: public const ERROR_CTX_CDM_CONNECT = 7066;
1697: public const ERROR_CTX_CDM_DISCONNECT = 7067;
1698: public const ERROR_CTX_SECURITY_LAYER_ERROR = 7068;
1699: public const ERROR_TS_INCOMPATIBLE_SESSIONS = 7069;
1700: public const ERROR_TS_VIDEO_SUBSYSTEM_ERROR = 7070;
1701: public const FRS_ERR_INVALID_API_SEQUENCE = 8001;
1702: public const FRS_ERR_STARTING_SERVICE = 8002;
1703: public const FRS_ERR_STOPPING_SERVICE = 8003;
1704: public const FRS_ERR_INTERNAL_API = 8004;
1705: public const FRS_ERR_INTERNAL = 8005;
1706: public const FRS_ERR_SERVICE_COMM = 8006;
1707: public const FRS_ERR_INSUFFICIENT_PRIV = 8007;
1708: public const FRS_ERR_AUTHENTICATION = 8008;
1709: public const FRS_ERR_PARENT_INSUFFICIENT_PRIV = 8009;
1710: public const FRS_ERR_PARENT_AUTHENTICATION = 8010;
1711: public const FRS_ERR_CHILD_TO_PARENT_COMM = 8011;
1712: public const FRS_ERR_PARENT_TO_CHILD_COMM = 8012;
1713: public const FRS_ERR_SYSVOL_POPULATE = 8013;
1714: public const FRS_ERR_SYSVOL_POPULATE_TIMEOUT = 8014;
1715: public const FRS_ERR_SYSVOL_IS_BUSY = 8015;
1716: public const FRS_ERR_SYSVOL_DEMOTE = 8016;
1717: public const FRS_ERR_INVALID_SERVICE_PARAMETER = 8017;
1718: public const ERROR_DS_NOT_INSTALLED = 8200;
1719: public const ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY = 8201;
1720: public const ERROR_DS_NO_ATTRIBUTE_OR_VALUE = 8202;
1721: public const ERROR_DS_INVALID_ATTRIBUTE_SYNTAX = 8203;
1722: public const ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED = 8204;
1723: public const ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS = 8205;
1724: public const ERROR_DS_BUSY = 8206;
1725: public const ERROR_DS_UNAVAILABLE = 8207;
1726: public const ERROR_DS_NO_RIDS_ALLOCATED = 8208;
1727: public const ERROR_DS_NO_MORE_RIDS = 8209;
1728: public const ERROR_DS_INCORRECT_ROLE_OWNER = 8210;
1729: public const ERROR_DS_RIDMGR_INIT_ERROR = 8211;
1730: public const ERROR_DS_OBJ_CLASS_VIOLATION = 8212;
1731: public const ERROR_DS_CANT_ON_NON_LEAF = 8213;
1732: public const ERROR_DS_CANT_ON_RDN = 8214;
1733: public const ERROR_DS_CANT_MOD_OBJ_CLASS = 8215;
1734: public const ERROR_DS_CROSS_DOM_MOVE_ERROR = 8216;
1735: public const ERROR_DS_GC_NOT_AVAILABLE = 8217;
1736: public const ERROR_SHARED_POLICY = 8218;
1737: public const ERROR_POLICY_OBJECT_NOT_FOUND = 8219;
1738: public const ERROR_POLICY_ONLY_IN_DS = 8220;
1739: public const ERROR_PROMOTION_ACTIVE = 8221;
1740: public const ERROR_NO_PROMOTION_ACTIVE = 8222;
1741: public const ERROR_DS_OPERATIONS_ERROR = 8224;
1742: public const ERROR_DS_PROTOCOL_ERROR = 8225;
1743: public const ERROR_DS_TIMELIMIT_EXCEEDED = 8226;
1744: public const ERROR_DS_SIZELIMIT_EXCEEDED = 8227;
1745: public const ERROR_DS_ADMIN_LIMIT_EXCEEDED = 8228;
1746: public const ERROR_DS_COMPARE_FALSE = 8229;
1747: public const ERROR_DS_COMPARE_TRUE = 8230;
1748: public const ERROR_DS_AUTH_METHOD_NOT_SUPPORTED = 8231;
1749: public const ERROR_DS_STRONG_AUTH_REQUIRED = 8232;
1750: public const ERROR_DS_INAPPROPRIATE_AUTH = 8233;
1751: public const ERROR_DS_AUTH_UNKNOWN = 8234;
1752: public const ERROR_DS_REFERRAL = 8235;
1753: public const ERROR_DS_UNAVAILABLE_CRIT_EXTENSION = 8236;
1754: public const ERROR_DS_CONFIDENTIALITY_REQUIRED = 8237;
1755: public const ERROR_DS_INAPPROPRIATE_MATCHING = 8238;
1756: public const ERROR_DS_CONSTRAINT_VIOLATION = 8239;
1757: public const ERROR_DS_NO_SUCH_OBJECT = 8240;
1758: public const ERROR_DS_ALIAS_PROBLEM = 8241;
1759: public const ERROR_DS_INVALID_DN_SYNTAX = 8242;
1760: public const ERROR_DS_IS_LEAF = 8243;
1761: public const ERROR_DS_ALIAS_DEREF_PROBLEM = 8244;
1762: public const ERROR_DS_UNWILLING_TO_PERFORM = 8245;
1763: public const ERROR_DS_LOOP_DETECT = 8246;
1764: public const ERROR_DS_NAMING_VIOLATION = 8247;
1765: public const ERROR_DS_OBJECT_RESULTS_TOO_LARGE = 8248;
1766: public const ERROR_DS_AFFECTS_MULTIPLE_DSAS = 8249;
1767: public const ERROR_DS_SERVER_DOWN = 8250;
1768: public const ERROR_DS_LOCAL_ERROR = 8251;
1769: public const ERROR_DS_ENCODING_ERROR = 8252;
1770: public const ERROR_DS_DECODING_ERROR = 8253;
1771: public const ERROR_DS_FILTER_UNKNOWN = 8254;
1772: public const ERROR_DS_PARAM_ERROR = 8255;
1773: public const ERROR_DS_NOT_SUPPORTED = 8256;
1774: public const ERROR_DS_NO_RESULTS_RETURNED = 8257;
1775: public const ERROR_DS_CONTROL_NOT_FOUND = 8258;
1776: public const ERROR_DS_CLIENT_LOOP = 8259;
1777: public const ERROR_DS_REFERRAL_LIMIT_EXCEEDED = 8260;
1778: public const ERROR_DS_SORT_CONTROL_MISSING = 8261;
1779: public const ERROR_DS_OFFSET_RANGE_ERROR = 8262;
1780: public const ERROR_DS_RIDMGR_DISABLED = 8263;
1781: public const ERROR_DS_ROOT_MUST_BE_NC = 8301;
1782: public const ERROR_DS_ADD_REPLICA_INHIBITED = 8302;
1783: public const ERROR_DS_ATT_NOT_DEF_IN_SCHEMA = 8303;
1784: public const ERROR_DS_MAX_OBJ_SIZE_EXCEEDED = 8304;
1785: public const ERROR_DS_OBJ_STRING_NAME_EXISTS = 8305;
1786: public const ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA = 8306;
1787: public const ERROR_DS_RDN_DOESNT_MATCH_SCHEMA = 8307;
1788: public const ERROR_DS_NO_REQUESTED_ATTS_FOUND = 8308;
1789: public const ERROR_DS_USER_BUFFER_TO_SMALL = 8309;
1790: public const ERROR_DS_ATT_IS_NOT_ON_OBJ = 8310;
1791: public const ERROR_DS_ILLEGAL_MOD_OPERATION = 8311;
1792: public const ERROR_DS_OBJ_TOO_LARGE = 8312;
1793: public const ERROR_DS_BAD_INSTANCE_TYPE = 8313;
1794: public const ERROR_DS_MASTERDSA_REQUIRED = 8314;
1795: public const ERROR_DS_OBJECT_CLASS_REQUIRED = 8315;
1796: public const ERROR_DS_MISSING_REQUIRED_ATT = 8316;
1797: public const ERROR_DS_ATT_NOT_DEF_FOR_CLASS = 8317;
1798: public const ERROR_DS_ATT_ALREADY_EXISTS = 8318;
1799: public const ERROR_DS_CANT_ADD_ATT_VALUES = 8320;
1800: public const ERROR_DS_SINGLE_VALUE_CONSTRAINT = 8321;
1801: public const ERROR_DS_RANGE_CONSTRAINT = 8322;
1802: public const ERROR_DS_ATT_VAL_ALREADY_EXISTS = 8323;
1803: public const ERROR_DS_CANT_REM_MISSING_ATT = 8324;
1804: public const ERROR_DS_CANT_REM_MISSING_ATT_VAL = 8325;
1805: public const ERROR_DS_ROOT_CANT_BE_SUBREF = 8326;
1806: public const ERROR_DS_NO_CHAINING = 8327;
1807: public const ERROR_DS_NO_CHAINED_EVAL = 8328;
1808: public const ERROR_DS_NO_PARENT_OBJECT = 8329;
1809: public const ERROR_DS_PARENT_IS_AN_ALIAS = 8330;
1810: public const ERROR_DS_CANT_MIX_MASTER_AND_REPS = 8331;
1811: public const ERROR_DS_CHILDREN_EXIST = 8332;
1812: public const ERROR_DS_OBJ_NOT_FOUND = 8333;
1813: public const ERROR_DS_ALIASED_OBJ_MISSING = 8334;
1814: public const ERROR_DS_BAD_NAME_SYNTAX = 8335;
1815: public const ERROR_DS_ALIAS_POINTS_TO_ALIAS = 8336;
1816: public const ERROR_DS_CANT_DEREF_ALIAS = 8337;
1817: public const ERROR_DS_OUT_OF_SCOPE = 8338;
1818: public const ERROR_DS_OBJECT_BEING_REMOVED = 8339;
1819: public const ERROR_DS_CANT_DELETE_DSA_OBJ = 8340;
1820: public const ERROR_DS_GENERIC_ERROR = 8341;
1821: public const ERROR_DS_DSA_MUST_BE_INT_MASTER = 8342;
1822: public const ERROR_DS_CLASS_NOT_DSA = 8343;
1823: public const ERROR_DS_INSUFF_ACCESS_RIGHTS = 8344;
1824: public const ERROR_DS_ILLEGAL_SUPERIOR = 8345;
1825: public const ERROR_DS_ATTRIBUTE_OWNED_BY_SAM = 8346;
1826: public const ERROR_DS_NAME_TOO_MANY_PARTS = 8347;
1827: public const ERROR_DS_NAME_TOO_LONG = 8348;
1828: public const ERROR_DS_NAME_VALUE_TOO_LONG = 8349;
1829: public const ERROR_DS_NAME_UNPARSEABLE = 8350;
1830: public const ERROR_DS_NAME_TYPE_UNKNOWN = 8351;
1831: public const ERROR_DS_NOT_AN_OBJECT = 8352;
1832: public const ERROR_DS_SEC_DESC_TOO_SHORT = 8353;
1833: public const ERROR_DS_SEC_DESC_INVALID = 8354;
1834: public const ERROR_DS_NO_DELETED_NAME = 8355;
1835: public const ERROR_DS_SUBREF_MUST_HAVE_PARENT = 8356;
1836: public const ERROR_DS_NCNAME_MUST_BE_NC = 8357;
1837: public const ERROR_DS_CANT_ADD_SYSTEM_ONLY = 8358;
1838: public const ERROR_DS_CLASS_MUST_BE_CONCRETE = 8359;
1839: public const ERROR_DS_INVALID_DMD = 8360;
1840: public const ERROR_DS_OBJ_GUID_EXISTS = 8361;
1841: public const ERROR_DS_NOT_ON_BACKLINK = 8362;
1842: public const ERROR_DS_NO_CROSSREF_FOR_NC = 8363;
1843: public const ERROR_DS_SHUTTING_DOWN = 8364;
1844: public const ERROR_DS_UNKNOWN_OPERATION = 8365;
1845: public const ERROR_DS_INVALID_ROLE_OWNER = 8366;
1846: public const ERROR_DS_COULDNT_CONTACT_FSMO = 8367;
1847: public const ERROR_DS_CROSS_NC_DN_RENAME = 8368;
1848: public const ERROR_DS_CANT_MOD_SYSTEM_ONLY = 8369;
1849: public const ERROR_DS_REPLICATOR_ONLY = 8370;
1850: public const ERROR_DS_OBJ_CLASS_NOT_DEFINED = 8371;
1851: public const ERROR_DS_OBJ_CLASS_NOT_SUBCLASS = 8372;
1852: public const ERROR_DS_NAME_REFERENCE_INVALID = 8373;
1853: public const ERROR_DS_CROSS_REF_EXISTS = 8374;
1854: public const ERROR_DS_CANT_DEL_MASTER_CROSSREF = 8375;
1855: public const ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD = 8376;
1856: public const ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX = 8377;
1857: public const ERROR_DS_DUP_RDN = 8378;
1858: public const ERROR_DS_DUP_OID = 8379;
1859: public const ERROR_DS_DUP_MAPI_ID = 8380;
1860: public const ERROR_DS_DUP_SCHEMA_ID_GUID = 8381;
1861: public const ERROR_DS_DUP_LDAP_DISPLAY_NAME = 8382;
1862: public const ERROR_DS_SEMANTIC_ATT_TEST = 8383;
1863: public const ERROR_DS_SYNTAX_MISMATCH = 8384;
1864: public const ERROR_DS_EXISTS_IN_MUST_HAVE = 8385;
1865: public const ERROR_DS_EXISTS_IN_MAY_HAVE = 8386;
1866: public const ERROR_DS_NONEXISTENT_MAY_HAVE = 8387;
1867: public const ERROR_DS_NONEXISTENT_MUST_HAVE = 8388;
1868: public const ERROR_DS_AUX_CLS_TEST_FAIL = 8389;
1869: public const ERROR_DS_NONEXISTENT_POSS_SUP = 8390;
1870: public const ERROR_DS_SUB_CLS_TEST_FAIL = 8391;
1871: public const ERROR_DS_BAD_RDN_ATT_ID_SYNTAX = 8392;
1872: public const ERROR_DS_EXISTS_IN_AUX_CLS = 8393;
1873: public const ERROR_DS_EXISTS_IN_SUB_CLS = 8394;
1874: public const ERROR_DS_EXISTS_IN_POSS_SUP = 8395;
1875: public const ERROR_DS_RECALCSCHEMA_FAILED = 8396;
1876: public const ERROR_DS_TREE_DELETE_NOT_FINISHED = 8397;
1877: public const ERROR_DS_CANT_DELETE = 8398;
1878: public const ERROR_DS_ATT_SCHEMA_REQ_ID = 8399;
1879: public const ERROR_DS_BAD_ATT_SCHEMA_SYNTAX = 8400;
1880: public const ERROR_DS_CANT_CACHE_ATT = 8401;
1881: public const ERROR_DS_CANT_CACHE_CLASS = 8402;
1882: public const ERROR_DS_CANT_REMOVE_ATT_CACHE = 8403;
1883: public const ERROR_DS_CANT_REMOVE_CLASS_CACHE = 8404;
1884: public const ERROR_DS_CANT_RETRIEVE_DN = 8405;
1885: public const ERROR_DS_MISSING_SUPREF = 8406;
1886: public const ERROR_DS_CANT_RETRIEVE_INSTANCE = 8407;
1887: public const ERROR_DS_CODE_INCONSISTENCY = 8408;
1888: public const ERROR_DS_DATABASE_ERROR = 8409;
1889: public const ERROR_DS_GOVERNSID_MISSING = 8410;
1890: public const ERROR_DS_MISSING_EXPECTED_ATT = 8411;
1891: public const ERROR_DS_NCNAME_MISSING_CR_REF = 8412;
1892: public const ERROR_DS_SECURITY_CHECKING_ERROR = 8413;
1893: public const ERROR_DS_SCHEMA_NOT_LOADED = 8414;
1894: public const ERROR_DS_SCHEMA_ALLOC_FAILED = 8415;
1895: public const ERROR_DS_ATT_SCHEMA_REQ_SYNTAX = 8416;
1896: public const ERROR_DS_GCVERIFY_ERROR = 8417;
1897: public const ERROR_DS_DRA_SCHEMA_MISMATCH = 8418;
1898: public const ERROR_DS_CANT_FIND_DSA_OBJ = 8419;
1899: public const ERROR_DS_CANT_FIND_EXPECTED_NC = 8420;
1900: public const ERROR_DS_CANT_FIND_NC_IN_CACHE = 8421;
1901: public const ERROR_DS_CANT_RETRIEVE_CHILD = 8422;
1902: public const ERROR_DS_SECURITY_ILLEGAL_MODIFY = 8423;
1903: public const ERROR_DS_CANT_REPLACE_HIDDEN_REC = 8424;
1904: public const ERROR_DS_BAD_HIERARCHY_FILE = 8425;
1905: public const ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED = 8426;
1906: public const ERROR_DS_CONFIG_PARAM_MISSING = 8427;
1907: public const ERROR_DS_COUNTING_AB_INDICES_FAILED = 8428;
1908: public const ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED = 8429;
1909: public const ERROR_DS_INTERNAL_FAILURE = 8430;
1910: public const ERROR_DS_UNKNOWN_ERROR = 8431;
1911: public const ERROR_DS_ROOT_REQUIRES_CLASS_TOP = 8432;
1912: public const ERROR_DS_REFUSING_FSMO_ROLES = 8433;
1913: public const ERROR_DS_MISSING_FSMO_SETTINGS = 8434;
1914: public const ERROR_DS_UNABLE_TO_SURRENDER_ROLES = 8435;
1915: public const ERROR_DS_DRA_GENERIC = 8436;
1916: public const ERROR_DS_DRA_INVALID_PARAMETER = 8437;
1917: public const ERROR_DS_DRA_BUSY = 8438;
1918: public const ERROR_DS_DRA_BAD_DN = 8439;
1919: public const ERROR_DS_DRA_BAD_NC = 8440;
1920: public const ERROR_DS_DRA_DN_EXISTS = 8441;
1921: public const ERROR_DS_DRA_INTERNAL_ERROR = 8442;
1922: public const ERROR_DS_DRA_INCONSISTENT_DIT = 8443;
1923: public const ERROR_DS_DRA_CONNECTION_FAILED = 8444;
1924: public const ERROR_DS_DRA_BAD_INSTANCE_TYPE = 8445;
1925: public const ERROR_DS_DRA_OUT_OF_MEM = 8446;
1926: public const ERROR_DS_DRA_MAIL_PROBLEM = 8447;
1927: public const ERROR_DS_DRA_REF_ALREADY_EXISTS = 8448;
1928: public const ERROR_DS_DRA_REF_NOT_FOUND = 8449;
1929: public const ERROR_DS_DRA_OBJ_IS_REP_SOURCE = 8450;
1930: public const ERROR_DS_DRA_DB_ERROR = 8451;
1931: public const ERROR_DS_DRA_NO_REPLICA = 8452;
1932: public const ERROR_DS_DRA_ACCESS_DENIED = 8453;
1933: public const ERROR_DS_DRA_NOT_SUPPORTED = 8454;
1934: public const ERROR_DS_DRA_RPC_CANCELLED = 8455;
1935: public const ERROR_DS_DRA_SOURCE_DISABLED = 8456;
1936: public const ERROR_DS_DRA_SINK_DISABLED = 8457;
1937: public const ERROR_DS_DRA_NAME_COLLISION = 8458;
1938: public const ERROR_DS_DRA_SOURCE_REINSTALLED = 8459;
1939: public const ERROR_DS_DRA_MISSING_PARENT = 8460;
1940: public const ERROR_DS_DRA_PREEMPTED = 8461;
1941: public const ERROR_DS_DRA_ABANDON_SYNC = 8462;
1942: public const ERROR_DS_DRA_SHUTDOWN = 8463;
1943: public const ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET = 8464;
1944: public const ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA = 8465;
1945: public const ERROR_DS_DRA_EXTN_CONNECTION_FAILED = 8466;
1946: public const ERROR_DS_INSTALL_SCHEMA_MISMATCH = 8467;
1947: public const ERROR_DS_DUP_LINK_ID = 8468;
1948: public const ERROR_DS_NAME_ERROR_RESOLVING = 8469;
1949: public const ERROR_DS_NAME_ERROR_NOT_FOUND = 8470;
1950: public const ERROR_DS_NAME_ERROR_NOT_UNIQUE = 8471;
1951: public const ERROR_DS_NAME_ERROR_NO_MAPPING = 8472;
1952: public const ERROR_DS_NAME_ERROR_DOMAIN_ONLY = 8473;
1953: public const ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 8474;
1954: public const ERROR_DS_CONSTRUCTED_ATT_MOD = 8475;
1955: public const ERROR_DS_WRONG_OM_OBJ_CLASS = 8476;
1956: public const ERROR_DS_DRA_REPL_PENDING = 8477;
1957: public const ERROR_DS_DS_REQUIRED = 8478;
1958: public const ERROR_DS_INVALID_LDAP_DISPLAY_NAME = 8479;
1959: public const ERROR_DS_NON_BASE_SEARCH = 8480;
1960: public const ERROR_DS_CANT_RETRIEVE_ATTS = 8481;
1961: public const ERROR_DS_BACKLINK_WITHOUT_LINK = 8482;
1962: public const ERROR_DS_EPOCH_MISMATCH = 8483;
1963: public const ERROR_DS_SRC_NAME_MISMATCH = 8484;
1964: public const ERROR_DS_SRC_AND_DST_NC_IDENTICAL = 8485;
1965: public const ERROR_DS_DST_NC_MISMATCH = 8486;
1966: public const ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC = 8487;
1967: public const ERROR_DS_SRC_GUID_MISMATCH = 8488;
1968: public const ERROR_DS_CANT_MOVE_DELETED_OBJECT = 8489;
1969: public const ERROR_DS_PDC_OPERATION_IN_PROGRESS = 8490;
1970: public const ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD = 8491;
1971: public const ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION = 8492;
1972: public const ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS = 8493;
1973: public const ERROR_DS_NC_MUST_HAVE_NC_PARENT = 8494;
1974: public const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE = 8495;
1975: public const ERROR_DS_DST_DOMAIN_NOT_NATIVE = 8496;
1976: public const ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER = 8497;
1977: public const ERROR_DS_CANT_MOVE_ACCOUNT_GROUP = 8498;
1978: public const ERROR_DS_CANT_MOVE_RESOURCE_GROUP = 8499;
1979: public const ERROR_DS_INVALID_SEARCH_FLAG = 8500;
1980: public const ERROR_DS_NO_TREE_DELETE_ABOVE_NC = 8501;
1981: public const ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE = 8502;
1982: public const ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE = 8503;
1983: public const ERROR_DS_SAM_INIT_FAILURE = 8504;
1984: public const ERROR_DS_SENSITIVE_GROUP_VIOLATION = 8505;
1985: public const ERROR_DS_CANT_MOD_PRIMARYGROUPID = 8506;
1986: public const ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD = 8507;
1987: public const ERROR_DS_NONSAFE_SCHEMA_CHANGE = 8508;
1988: public const ERROR_DS_SCHEMA_UPDATE_DISALLOWED = 8509;
1989: public const ERROR_DS_CANT_CREATE_UNDER_SCHEMA = 8510;
1990: public const ERROR_DS_INSTALL_NO_SRC_SCH_VERSION = 8511;
1991: public const ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE = 8512;
1992: public const ERROR_DS_INVALID_GROUP_TYPE = 8513;
1993: public const ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = 8514;
1994: public const ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = 8515;
1995: public const ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = 8516;
1996: public const ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = 8517;
1997: public const ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = 8518;
1998: public const ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = 8519;
1999: public const ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = 8520;
2000: public const ERROR_DS_HAVE_PRIMARY_MEMBERS = 8521;
2001: public const ERROR_DS_STRING_SD_CONVERSION_FAILED = 8522;
2002: public const ERROR_DS_NAMING_MASTER_GC = 8523;
2003: public const ERROR_DS_DNS_LOOKUP_FAILURE = 8524;
2004: public const ERROR_DS_COULDNT_UPDATE_SPNS = 8525;
2005: public const ERROR_DS_CANT_RETRIEVE_SD = 8526;
2006: public const ERROR_DS_KEY_NOT_UNIQUE = 8527;
2007: public const ERROR_DS_WRONG_LINKED_ATT_SYNTAX = 8528;
2008: public const ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD = 8529;
2009: public const ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY = 8530;
2010: public const ERROR_DS_CANT_START = 8531;
2011: public const ERROR_DS_INIT_FAILURE = 8532;
2012: public const ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION = 8533;
2013: public const ERROR_DS_SOURCE_DOMAIN_IN_FOREST = 8534;
2014: public const ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST = 8535;
2015: public const ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED = 8536;
2016: public const ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN = 8537;
2017: public const ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER = 8538;
2018: public const ERROR_DS_SRC_SID_EXISTS_IN_FOREST = 8539;
2019: public const ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH = 8540;
2020: public const ERROR_SAM_INIT_FAILURE = 8541;
2021: public const ERROR_DS_DRA_SCHEMA_INFO_SHIP = 8542;
2022: public const ERROR_DS_DRA_SCHEMA_CONFLICT = 8543;
2023: public const ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT = 8544;
2024: public const ERROR_DS_DRA_OBJ_NC_MISMATCH = 8545;
2025: public const ERROR_DS_NC_STILL_HAS_DSAS = 8546;
2026: public const ERROR_DS_GC_REQUIRED = 8547;
2027: public const ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY = 8548;
2028: public const ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS = 8549;
2029: public const ERROR_DS_CANT_ADD_TO_GC = 8550;
2030: public const ERROR_DS_NO_CHECKPOINT_WITH_PDC = 8551;
2031: public const ERROR_DS_SOURCE_AUDITING_NOT_ENABLED = 8552;
2032: public const ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC = 8553;
2033: public const ERROR_DS_INVALID_NAME_FOR_SPN = 8554;
2034: public const ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS = 8555;
2035: public const ERROR_DS_UNICODEPWD_NOT_IN_QUOTES = 8556;
2036: public const ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = 8557;
2037: public const ERROR_DS_MUST_BE_RUN_ON_DST_DC = 8558;
2038: public const ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER = 8559;
2039: public const ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ = 8560;
2040: public const ERROR_DS_INIT_FAILURE_CONSOLE = 8561;
2041: public const ERROR_DS_SAM_INIT_FAILURE_CONSOLE = 8562;
2042: public const ERROR_DS_FOREST_VERSION_TOO_HIGH = 8563;
2043: public const ERROR_DS_DOMAIN_VERSION_TOO_HIGH = 8564;
2044: public const ERROR_DS_FOREST_VERSION_TOO_LOW = 8565;
2045: public const ERROR_DS_DOMAIN_VERSION_TOO_LOW = 8566;
2046: public const ERROR_DS_INCOMPATIBLE_VERSION = 8567;
2047: public const ERROR_DS_LOW_DSA_VERSION = 8568;
2048: public const ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN = 8569;
2049: public const ERROR_DS_NOT_SUPPORTED_SORT_ORDER = 8570;
2050: public const ERROR_DS_NAME_NOT_UNIQUE = 8571;
2051: public const ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 = 8572;
2052: public const ERROR_DS_OUT_OF_VERSION_STORE = 8573;
2053: public const ERROR_DS_INCOMPATIBLE_CONTROLS_USED = 8574;
2054: public const ERROR_DS_NO_REF_DOMAIN = 8575;
2055: public const ERROR_DS_RESERVED_LINK_ID = 8576;
2056: public const ERROR_DS_LINK_ID_NOT_AVAILABLE = 8577;
2057: public const ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = 8578;
2058: public const ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE = 8579;
2059: public const ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC = 8580;
2060: public const ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG = 8581;
2061: public const ERROR_DS_MODIFYDN_WRONG_GRANDPARENT = 8582;
2062: public const ERROR_DS_NAME_ERROR_TRUST_REFERRAL = 8583;
2063: public const ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER = 8584;
2064: public const ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD = 8585;
2065: public const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 = 8586;
2066: public const ERROR_DS_THREAD_LIMIT_EXCEEDED = 8587;
2067: public const ERROR_DS_NOT_CLOSEST = 8588;
2068: public const ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF = 8589;
2069: public const ERROR_DS_SINGLE_USER_MODE_FAILED = 8590;
2070: public const ERROR_DS_NTDSCRIPT_SYNTAX_ERROR = 8591;
2071: public const ERROR_DS_NTDSCRIPT_PROCESS_ERROR = 8592;
2072: public const ERROR_DS_DIFFERENT_REPL_EPOCHS = 8593;
2073: public const ERROR_DS_DRS_EXTENSIONS_CHANGED = 8594;
2074: public const ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR = 8595;
2075: public const ERROR_DS_NO_MSDS_INTID = 8596;
2076: public const ERROR_DS_DUP_MSDS_INTID = 8597;
2077: public const ERROR_DS_EXISTS_IN_RDNATTID = 8598;
2078: public const ERROR_DS_AUTHORIZATION_FAILED = 8599;
2079: public const ERROR_DS_INVALID_SCRIPT = 8600;
2080: public const ERROR_DS_REMOTE_CROSSREF_OP_FAILED = 8601;
2081: public const ERROR_DS_CROSS_REF_BUSY = 8602;
2082: public const ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN = 8603;
2083: public const ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC = 8604;
2084: public const ERROR_DS_DUPLICATE_ID_FOUND = 8605;
2085: public const ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT = 8606;
2086: public const ERROR_DS_GROUP_CONVERSION_ERROR = 8607;
2087: public const ERROR_DS_CANT_MOVE_APP_BASIC_GROUP = 8608;
2088: public const ERROR_DS_CANT_MOVE_APP_QUERY_GROUP = 8609;
2089: public const ERROR_DS_ROLE_NOT_VERIFIED = 8610;
2090: public const ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL = 8611;
2091: public const ERROR_DS_DOMAIN_RENAME_IN_PROGRESS = 8612;
2092: public const ERROR_DS_EXISTING_AD_CHILD_NC = 8613;
2093: public const ERROR_DS_REPL_LIFETIME_EXCEEDED = 8614;
2094: public const ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER = 8615;
2095: public const ERROR_DS_LDAP_SEND_QUEUE_FULL = 8616;
2096: public const ERROR_DS_DRA_OUT_SCHEDULE_WINDOW = 8617;
2097: public const ERROR_DS_POLICY_NOT_KNOWN = 8618;
2098: public const ERROR_NO_SITE_SETTINGS_OBJECT = 8619;
2099: public const ERROR_NO_SECRETS = 8620;
2100: public const ERROR_NO_WRITABLE_DC_FOUND = 8621;
2101: public const ERROR_DS_NO_SERVER_OBJECT = 8622;
2102: public const ERROR_DS_NO_NTDSA_OBJECT = 8623;
2103: public const ERROR_DS_NON_ASQ_SEARCH = 8624;
2104: public const ERROR_DS_AUDIT_FAILURE = 8625;
2105: public const ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE = 8626;
2106: public const ERROR_DS_INVALID_SEARCH_FLAG_TUPLE = 8627;
2107: public const ERROR_DS_HIERARCHY_TABLE_TOO_DEEP = 8628;
2108: public const ERROR_DS_DRA_CORRUPT_UTD_VECTOR = 8629;
2109: public const ERROR_DS_DRA_SECRETS_DENIED = 8630;
2110: public const ERROR_DS_RESERVED_MAPI_ID = 8631;
2111: public const ERROR_DS_MAPI_ID_NOT_AVAILABLE = 8632;
2112: public const ERROR_DS_DRA_MISSING_KRBTGT_SECRET = 8633;
2113: public const ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST = 8634;
2114: public const ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST = 8635;
2115: public const ERROR_INVALID_USER_PRINCIPAL_NAME = 8636;
2116: public const ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS = 8637;
2117: public const ERROR_DS_OID_NOT_FOUND = 8638;
2118: public const ERROR_DS_DRA_RECYCLED_TARGET = 8639;
2119: public const ERROR_DS_DISALLOWED_NC_REDIRECT = 8640;
2120: public const ERROR_DS_HIGH_ADLDS_FFL = 8641;
2121: public const ERROR_DS_HIGH_DSA_VERSION = 8642;
2122: public const ERROR_DS_LOW_ADLDS_FFL = 8643;
2123: public const ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION = 8644;
2124: public const ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED = 8645;
2125: public const ERROR_INCORRECT_ACCOUNT_TYPE = 8646;
2126: public const DNS_ERROR_RCODE_FORMAT_ERROR = 9001;
2127: public const DNS_ERROR_RCODE_SERVER_FAILURE = 9002;
2128: public const DNS_ERROR_RCODE_NAME_ERROR = 9003;
2129: public const DNS_ERROR_RCODE_NOT_IMPLEMENTED = 9004;
2130: public const DNS_ERROR_RCODE_REFUSED = 9005;
2131: public const DNS_ERROR_RCODE_YXDOMAIN = 9006;
2132: public const DNS_ERROR_RCODE_YXRRSET = 9007;
2133: public const DNS_ERROR_RCODE_NXRRSET = 9008;
2134: public const DNS_ERROR_RCODE_NOTAUTH = 9009;
2135: public const DNS_ERROR_RCODE_NOTZONE = 9010;
2136: public const DNS_ERROR_RCODE_BADSIG = 9016;
2137: public const DNS_ERROR_RCODE_BADKEY = 9017;
2138: public const DNS_ERROR_RCODE_BADTIME = 9018;
2139: public const DNS_ERROR_KEYMASTER_REQUIRED = 9101;
2140: public const DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE = 9102;
2141: public const DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1 = 9103;
2142: public const DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS = 9104;
2143: public const DNS_ERROR_UNSUPPORTED_ALGORITHM = 9105;
2144: public const DNS_ERROR_INVALID_KEY_SIZE = 9106;
2145: public const DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE = 9107;
2146: public const DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION = 9108;
2147: public const DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR = 9109;
2148: public const DNS_ERROR_UNEXPECTED_CNG_ERROR = 9110;
2149: public const DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION = 9111;
2150: public const DNS_ERROR_KSP_NOT_ACCESSIBLE = 9112;
2151: public const DNS_ERROR_TOO_MANY_SKDS = 9113;
2152: public const DNS_ERROR_INVALID_ROLLOVER_PERIOD = 9114;
2153: public const DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET = 9115;
2154: public const DNS_ERROR_ROLLOVER_IN_PROGRESS = 9116;
2155: public const DNS_ERROR_STANDBY_KEY_NOT_PRESENT = 9117;
2156: public const DNS_ERROR_NOT_ALLOWED_ON_ZSK = 9118;
2157: public const DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD = 9119;
2158: public const DNS_ERROR_ROLLOVER_ALREADY_QUEUED = 9120;
2159: public const DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE = 9121;
2160: public const DNS_ERROR_BAD_KEYMASTER = 9122;
2161: public const DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD = 9123;
2162: public const DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT = 9124;
2163: public const DNS_ERROR_DNSSEC_IS_DISABLED = 9125;
2164: public const DNS_ERROR_INVALID_XML = 9126;
2165: public const DNS_ERROR_NO_VALID_TRUST_ANCHORS = 9127;
2166: public const DNS_ERROR_ROLLOVER_NOT_POKEABLE = 9128;
2167: public const DNS_ERROR_NSEC3_NAME_COLLISION = 9129;
2168: public const DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1 = 9130;
2169: public const DNS_INFO_NO_RECORDS = 9501;
2170: public const DNS_ERROR_BAD_PACKET = 9502;
2171: public const DNS_ERROR_NO_PACKET = 9503;
2172: public const DNS_ERROR_RCODE = 9504;
2173: public const DNS_ERROR_UNSECURE_PACKET = 9505;
2174: public const DNS_REQUEST_PENDING = 9506;
2175: public const DNS_ERROR_INVALID_TYPE = 9551;
2176: public const DNS_ERROR_INVALID_IP_ADDRESS = 9552;
2177: public const DNS_ERROR_INVALID_PROPERTY = 9553;
2178: public const DNS_ERROR_TRY_AGAIN_LATER = 9554;
2179: public const DNS_ERROR_NOT_UNIQUE = 9555;
2180: public const DNS_ERROR_NON_RFC_NAME = 9556;
2181: public const DNS_STATUS_FQDN = 9557;
2182: public const DNS_STATUS_DOTTED_NAME = 9558;
2183: public const DNS_STATUS_SINGLE_PART_NAME = 9559;
2184: public const DNS_ERROR_INVALID_NAME_CHAR = 9560;
2185: public const DNS_ERROR_NUMERIC_NAME = 9561;
2186: public const DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER = 9562;
2187: public const DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION = 9563;
2188: public const DNS_ERROR_CANNOT_FIND_ROOT_HINTS = 9564;
2189: public const DNS_ERROR_INCONSISTENT_ROOT_HINTS = 9565;
2190: public const DNS_ERROR_DWORD_VALUE_TOO_SMALL = 9566;
2191: public const DNS_ERROR_DWORD_VALUE_TOO_LARGE = 9567;
2192: public const DNS_ERROR_BACKGROUND_LOADING = 9568;
2193: public const DNS_ERROR_NOT_ALLOWED_ON_RODC = 9569;
2194: public const DNS_ERROR_NOT_ALLOWED_UNDER_DNAME = 9570;
2195: public const DNS_ERROR_DELEGATION_REQUIRED = 9571;
2196: public const DNS_ERROR_INVALID_POLICY_TABLE = 9572;
2197: public const DNS_ERROR_ZONE_DOES_NOT_EXIST = 9601;
2198: public const DNS_ERROR_NO_ZONE_INFO = 9602;
2199: public const DNS_ERROR_INVALID_ZONE_OPERATION = 9603;
2200: public const DNS_ERROR_ZONE_CONFIGURATION_ERROR = 9604;
2201: public const DNS_ERROR_ZONE_HAS_NO_SOA_RECORD = 9605;
2202: public const DNS_ERROR_ZONE_HAS_NO_NS_RECORDS = 9606;
2203: public const DNS_ERROR_ZONE_LOCKED = 9607;
2204: public const DNS_ERROR_ZONE_CREATION_FAILED = 9608;
2205: public const DNS_ERROR_ZONE_ALREADY_EXISTS = 9609;
2206: public const DNS_ERROR_AUTOZONE_ALREADY_EXISTS = 9610;
2207: public const DNS_ERROR_INVALID_ZONE_TYPE = 9611;
2208: public const DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP = 9612;
2209: public const DNS_ERROR_ZONE_NOT_SECONDARY = 9613;
2210: public const DNS_ERROR_NEED_SECONDARY_ADDRESSES = 9614;
2211: public const DNS_ERROR_WINS_INIT_FAILED = 9615;
2212: public const DNS_ERROR_NEED_WINS_SERVERS = 9616;
2213: public const DNS_ERROR_NBSTAT_INIT_FAILED = 9617;
2214: public const DNS_ERROR_SOA_DELETE_INVALID = 9618;
2215: public const DNS_ERROR_FORWARDER_ALREADY_EXISTS = 9619;
2216: public const DNS_ERROR_ZONE_REQUIRES_MASTER_IP = 9620;
2217: public const DNS_ERROR_ZONE_IS_SHUTDOWN = 9621;
2218: public const DNS_ERROR_ZONE_LOCKED_FOR_SIGNING = 9622;
2219: public const DNS_ERROR_PRIMARY_REQUIRES_DATAFILE = 9651;
2220: public const DNS_ERROR_INVALID_DATAFILE_NAME = 9652;
2221: public const DNS_ERROR_DATAFILE_OPEN_FAILURE = 9653;
2222: public const DNS_ERROR_FILE_WRITEBACK_FAILED = 9654;
2223: public const DNS_ERROR_DATAFILE_PARSING = 9655;
2224: public const DNS_ERROR_RECORD_DOES_NOT_EXIST = 9701;
2225: public const DNS_ERROR_RECORD_FORMAT = 9702;
2226: public const DNS_ERROR_NODE_CREATION_FAILED = 9703;
2227: public const DNS_ERROR_UNKNOWN_RECORD_TYPE = 9704;
2228: public const DNS_ERROR_RECORD_TIMED_OUT = 9705;
2229: public const DNS_ERROR_NAME_NOT_IN_ZONE = 9706;
2230: public const DNS_ERROR_CNAME_LOOP = 9707;
2231: public const DNS_ERROR_NODE_IS_CNAME = 9708;
2232: public const DNS_ERROR_CNAME_COLLISION = 9709;
2233: public const DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT = 9710;
2234: public const DNS_ERROR_RECORD_ALREADY_EXISTS = 9711;
2235: public const DNS_ERROR_SECONDARY_DATA = 9712;
2236: public const DNS_ERROR_NO_CREATE_CACHE_DATA = 9713;
2237: public const DNS_ERROR_NAME_DOES_NOT_EXIST = 9714;
2238: public const DNS_WARNING_PTR_CREATE_FAILED = 9715;
2239: public const DNS_WARNING_DOMAIN_UNDELETED = 9716;
2240: public const DNS_ERROR_DS_UNAVAILABLE = 9717;
2241: public const DNS_ERROR_DS_ZONE_ALREADY_EXISTS = 9718;
2242: public const DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE = 9719;
2243: public const DNS_ERROR_NODE_IS_DNAME = 9720;
2244: public const DNS_ERROR_DNAME_COLLISION = 9721;
2245: public const DNS_ERROR_ALIAS_LOOP = 9722;
2246: public const DNS_INFO_AXFR_COMPLETE = 9751;
2247: public const DNS_ERROR_AXFR = 9752;
2248: public const DNS_INFO_ADDED_LOCAL_WINS = 9753;
2249: public const DNS_STATUS_CONTINUE_NEEDED = 9801;
2250: public const DNS_ERROR_NO_TCPIP = 9851;
2251: public const DNS_ERROR_NO_DNS_SERVERS = 9852;
2252: public const DNS_ERROR_DP_DOES_NOT_EXIST = 9901;
2253: public const DNS_ERROR_DP_ALREADY_EXISTS = 9902;
2254: public const DNS_ERROR_DP_NOT_ENLISTED = 9903;
2255: public const DNS_ERROR_DP_ALREADY_ENLISTED = 9904;
2256: public const DNS_ERROR_DP_NOT_AVAILABLE = 9905;
2257: public const DNS_ERROR_DP_FSMO_ERROR = 9906;
2258: public const WSAEINTR = 10004;
2259: public const WSAEBADF = 10009;
2260: public const WSAEACCES = 10013;
2261: public const WSAEFAULT = 10014;
2262: public const WSAEINVAL = 10022;
2263: public const WSAEMFILE = 10024;
2264: public const WSAEWOULDBLOCK = 10035;
2265: public const WSAEINPROGRESS = 10036;
2266: public const WSAEALREADY = 10037;
2267: public const WSAENOTSOCK = 10038;
2268: public const WSAEDESTADDRREQ = 10039;
2269: public const WSAEMSGSIZE = 10040;
2270: public const WSAEPROTOTYPE = 10041;
2271: public const WSAENOPROTOOPT = 10042;
2272: public const WSAEPROTONOSUPPORT = 10043;
2273: public const WSAESOCKTNOSUPPORT = 10044;
2274: public const WSAEOPNOTSUPP = 10045;
2275: public const WSAEPFNOSUPPORT = 10046;
2276: public const WSAEAFNOSUPPORT = 10047;
2277: public const WSAEADDRINUSE = 10048;
2278: public const WSAEADDRNOTAVAIL = 10049;
2279: public const WSAENETDOWN = 10050;
2280: public const WSAENETUNREACH = 10051;
2281: public const WSAENETRESET = 10052;
2282: public const WSAECONNABORTED = 10053;
2283: public const WSAECONNRESET = 10054;
2284: public const WSAENOBUFS = 10055;
2285: public const WSAEISCONN = 10056;
2286: public const WSAENOTCONN = 10057;
2287: public const WSAESHUTDOWN = 10058;
2288: public const WSAETOOMANYREFS = 10059;
2289: public const WSAETIMEDOUT = 10060;
2290: public const WSAECONNREFUSED = 10061;
2291: public const WSAELOOP = 10062;
2292: public const WSAENAMETOOLONG = 10063;
2293: public const WSAEHOSTDOWN = 10064;
2294: public const WSAEHOSTUNREACH = 10065;
2295: public const WSAENOTEMPTY = 10066;
2296: public const WSAEPROCLIM = 10067;
2297: public const WSAEUSERS = 10068;
2298: public const WSAEDQUOT = 10069;
2299: public const WSAESTALE = 10070;
2300: public const WSAEREMOTE = 10071;
2301: public const WSASYSNOTREADY = 10091;
2302: public const WSAVERNOTSUPPORTED = 10092;
2303: public const WSANOTINITIALISED = 10093;
2304: public const WSAEDISCON = 10101;
2305: public const WSAENOMORE = 10102;
2306: public const WSAECANCELLED = 10103;
2307: public const WSAEINVALIDPROCTABLE = 10104;
2308: public const WSAEINVALIDPROVIDER = 10105;
2309: public const WSAEPROVIDERFAILEDINIT = 10106;
2310: public const WSASYSCALLFAILURE = 10107;
2311: public const WSASERVICE_NOT_FOUND = 10108;
2312: public const WSATYPE_NOT_FOUND = 10109;
2313: public const WSA_E_NO_MORE = 10110;
2314: public const WSA_E_CANCELLED = 10111;
2315: public const WSAEREFUSED = 10112;
2316: public const WSAHOST_NOT_FOUND = 11001;
2317: public const WSATRY_AGAIN = 11002;
2318: public const WSANO_RECOVERY = 11003;
2319: public const WSANO_DATA = 11004;
2320: public const WSA_QOS_RECEIVERS = 11005;
2321: public const WSA_QOS_SENDERS = 11006;
2322: public const WSA_QOS_NO_SENDERS = 11007;
2323: public const WSA_QOS_NO_RECEIVERS = 11008;
2324: public const WSA_QOS_REQUEST_CONFIRMED = 11009;
2325: public const WSA_QOS_ADMISSION_FAILURE = 11010;
2326: public const WSA_QOS_POLICY_FAILURE = 11011;
2327: public const WSA_QOS_BAD_STYLE = 11012;
2328: public const WSA_QOS_BAD_OBJECT = 11013;
2329: public const WSA_QOS_TRAFFIC_CTRL_ERROR = 11014;
2330: public const WSA_QOS_GENERIC_ERROR = 11015;
2331: public const WSA_QOS_ESERVICETYPE = 11016;
2332: public const WSA_QOS_EFLOWSPEC = 11017;
2333: public const WSA_QOS_EPROVSPECBUF = 11018;
2334: public const WSA_QOS_EFILTERSTYLE = 11019;
2335: public const WSA_QOS_EFILTERTYPE = 11020;
2336: public const WSA_QOS_EFILTERCOUNT = 11021;
2337: public const WSA_QOS_EOBJLENGTH = 11022;
2338: public const WSA_QOS_EFLOWCOUNT = 11023;
2339: public const WSA_QOS_EUNKOWNPSOBJ = 11024;
2340: public const WSA_QOS_EPOLICYOBJ = 11025;
2341: public const WSA_QOS_EFLOWDESC = 11026;
2342: public const WSA_QOS_EPSFLOWSPEC = 11027;
2343: public const WSA_QOS_EPSFILTERSPEC = 11028;
2344: public const WSA_QOS_ESDMODEOBJ = 11029;
2345: public const WSA_QOS_ESHAPERATEOBJ = 11030;
2346: public const WSA_QOS_RESERVED_PETYPE = 11031;
2347: public const WSA_SECURE_HOST_NOT_FOUND = 11032;
2348: public const WSA_IPSEC_NAME_POLICY_ERROR = 11033;
2349: public const ERROR_IPSEC_QM_POLICY_EXISTS = 13000;
2350: public const ERROR_IPSEC_QM_POLICY_NOT_FOUND = 13001;
2351: public const ERROR_IPSEC_QM_POLICY_IN_USE = 13002;
2352: public const ERROR_IPSEC_MM_POLICY_EXISTS = 13003;
2353: public const ERROR_IPSEC_MM_POLICY_NOT_FOUND = 13004;
2354: public const ERROR_IPSEC_MM_POLICY_IN_USE = 13005;
2355: public const ERROR_IPSEC_MM_FILTER_EXISTS = 13006;
2356: public const ERROR_IPSEC_MM_FILTER_NOT_FOUND = 13007;
2357: public const ERROR_IPSEC_TRANSPORT_FILTER_EXISTS = 13008;
2358: public const ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND = 13009;
2359: public const ERROR_IPSEC_MM_AUTH_EXISTS = 13010;
2360: public const ERROR_IPSEC_MM_AUTH_NOT_FOUND = 13011;
2361: public const ERROR_IPSEC_MM_AUTH_IN_USE = 13012;
2362: public const ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND = 13013;
2363: public const ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND = 13014;
2364: public const ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND = 13015;
2365: public const ERROR_IPSEC_TUNNEL_FILTER_EXISTS = 13016;
2366: public const ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND = 13017;
2367: public const ERROR_IPSEC_MM_FILTER_PENDING_DELETION = 13018;
2368: public const ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION = 13019;
2369: public const ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION = 13020;
2370: public const ERROR_IPSEC_MM_POLICY_PENDING_DELETION = 13021;
2371: public const ERROR_IPSEC_MM_AUTH_PENDING_DELETION = 13022;
2372: public const ERROR_IPSEC_QM_POLICY_PENDING_DELETION = 13023;
2373: public const WARNING_IPSEC_MM_POLICY_PRUNED = 13024;
2374: public const WARNING_IPSEC_QM_POLICY_PRUNED = 13025;
2375: public const ERROR_IPSEC_IKE_NEG_STATUS_BEGIN = 13800;
2376: public const ERROR_IPSEC_IKE_AUTH_FAIL = 13801;
2377: public const ERROR_IPSEC_IKE_ATTRIB_FAIL = 13802;
2378: public const ERROR_IPSEC_IKE_NEGOTIATION_PENDING = 13803;
2379: public const ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR = 13804;
2380: public const ERROR_IPSEC_IKE_TIMED_OUT = 13805;
2381: public const ERROR_IPSEC_IKE_NO_CERT = 13806;
2382: public const ERROR_IPSEC_IKE_SA_DELETED = 13807;
2383: public const ERROR_IPSEC_IKE_SA_REAPED = 13808;
2384: public const ERROR_IPSEC_IKE_MM_ACQUIRE_DROP = 13809;
2385: public const ERROR_IPSEC_IKE_QM_ACQUIRE_DROP = 13810;
2386: public const ERROR_IPSEC_IKE_QUEUE_DROP_MM = 13811;
2387: public const ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM = 13812;
2388: public const ERROR_IPSEC_IKE_DROP_NO_RESPONSE = 13813;
2389: public const ERROR_IPSEC_IKE_MM_DELAY_DROP = 13814;
2390: public const ERROR_IPSEC_IKE_QM_DELAY_DROP = 13815;
2391: public const ERROR_IPSEC_IKE_ERROR = 13816;
2392: public const ERROR_IPSEC_IKE_CRL_FAILED = 13817;
2393: public const ERROR_IPSEC_IKE_INVALID_KEY_USAGE = 13818;
2394: public const ERROR_IPSEC_IKE_INVALID_CERT_TYPE = 13819;
2395: public const ERROR_IPSEC_IKE_NO_PRIVATE_KEY = 13820;
2396: public const ERROR_IPSEC_IKE_SIMULTANEOUS_REKEY = 13821;
2397: public const ERROR_IPSEC_IKE_DH_FAIL = 13822;
2398: public const ERROR_IPSEC_IKE_CRITICAL_PAYLOAD_NOT_RECOGNIZED = 13823;
2399: public const ERROR_IPSEC_IKE_INVALID_HEADER = 13824;
2400: public const ERROR_IPSEC_IKE_NO_POLICY = 13825;
2401: public const ERROR_IPSEC_IKE_INVALID_SIGNATURE = 13826;
2402: public const ERROR_IPSEC_IKE_KERBEROS_ERROR = 13827;
2403: public const ERROR_IPSEC_IKE_NO_PUBLIC_KEY = 13828;
2404: public const ERROR_IPSEC_IKE_PROCESS_ERR = 13829;
2405: public const ERROR_IPSEC_IKE_PROCESS_ERR_SA = 13830;
2406: public const ERROR_IPSEC_IKE_PROCESS_ERR_PROP = 13831;
2407: public const ERROR_IPSEC_IKE_PROCESS_ERR_TRANS = 13832;
2408: public const ERROR_IPSEC_IKE_PROCESS_ERR_KE = 13833;
2409: public const ERROR_IPSEC_IKE_PROCESS_ERR_ID = 13834;
2410: public const ERROR_IPSEC_IKE_PROCESS_ERR_CERT = 13835;
2411: public const ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ = 13836;
2412: public const ERROR_IPSEC_IKE_PROCESS_ERR_HASH = 13837;
2413: public const ERROR_IPSEC_IKE_PROCESS_ERR_SIG = 13838;
2414: public const ERROR_IPSEC_IKE_PROCESS_ERR_NONCE = 13839;
2415: public const ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY = 13840;
2416: public const ERROR_IPSEC_IKE_PROCESS_ERR_DELETE = 13841;
2417: public const ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR = 13842;
2418: public const ERROR_IPSEC_IKE_INVALID_PAYLOAD = 13843;
2419: public const ERROR_IPSEC_IKE_LOAD_SOFT_SA = 13844;
2420: public const ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN = 13845;
2421: public const ERROR_IPSEC_IKE_INVALID_COOKIE = 13846;
2422: public const ERROR_IPSEC_IKE_NO_PEER_CERT = 13847;
2423: public const ERROR_IPSEC_IKE_PEER_CRL_FAILED = 13848;
2424: public const ERROR_IPSEC_IKE_POLICY_CHANGE = 13849;
2425: public const ERROR_IPSEC_IKE_NO_MM_POLICY = 13850;
2426: public const ERROR_IPSEC_IKE_NOTCBPRIV = 13851;
2427: public const ERROR_IPSEC_IKE_SECLOADFAIL = 13852;
2428: public const ERROR_IPSEC_IKE_FAILSSPINIT = 13853;
2429: public const ERROR_IPSEC_IKE_FAILQUERYSSP = 13854;
2430: public const ERROR_IPSEC_IKE_SRVACQFAIL = 13855;
2431: public const ERROR_IPSEC_IKE_SRVQUERYCRED = 13856;
2432: public const ERROR_IPSEC_IKE_GETSPIFAIL = 13857;
2433: public const ERROR_IPSEC_IKE_INVALID_FILTER = 13858;
2434: public const ERROR_IPSEC_IKE_OUT_OF_MEMORY = 13859;
2435: public const ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED = 13860;
2436: public const ERROR_IPSEC_IKE_INVALID_POLICY = 13861;
2437: public const ERROR_IPSEC_IKE_UNKNOWN_DOI = 13862;
2438: public const ERROR_IPSEC_IKE_INVALID_SITUATION = 13863;
2439: public const ERROR_IPSEC_IKE_DH_FAILURE = 13864;
2440: public const ERROR_IPSEC_IKE_INVALID_GROUP = 13865;
2441: public const ERROR_IPSEC_IKE_ENCRYPT = 13866;
2442: public const ERROR_IPSEC_IKE_DECRYPT = 13867;
2443: public const ERROR_IPSEC_IKE_POLICY_MATCH = 13868;
2444: public const ERROR_IPSEC_IKE_UNSUPPORTED_ID = 13869;
2445: public const ERROR_IPSEC_IKE_INVALID_HASH = 13870;
2446: public const ERROR_IPSEC_IKE_INVALID_HASH_ALG = 13871;
2447: public const ERROR_IPSEC_IKE_INVALID_HASH_SIZE = 13872;
2448: public const ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG = 13873;
2449: public const ERROR_IPSEC_IKE_INVALID_AUTH_ALG = 13874;
2450: public const ERROR_IPSEC_IKE_INVALID_SIG = 13875;
2451: public const ERROR_IPSEC_IKE_LOAD_FAILED = 13876;
2452: public const ERROR_IPSEC_IKE_RPC_DELETE = 13877;
2453: public const ERROR_IPSEC_IKE_BENIGN_REINIT = 13878;
2454: public const ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY = 13879;
2455: public const ERROR_IPSEC_IKE_INVALID_MAJOR_VERSION = 13880;
2456: public const ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN = 13881;
2457: public const ERROR_IPSEC_IKE_MM_LIMIT = 13882;
2458: public const ERROR_IPSEC_IKE_NEGOTIATION_DISABLED = 13883;
2459: public const ERROR_IPSEC_IKE_QM_LIMIT = 13884;
2460: public const ERROR_IPSEC_IKE_MM_EXPIRED = 13885;
2461: public const ERROR_IPSEC_IKE_PEER_MM_ASSUMED_INVALID = 13886;
2462: public const ERROR_IPSEC_IKE_CERT_CHAIN_POLICY_MISMATCH = 13887;
2463: public const ERROR_IPSEC_IKE_UNEXPECTED_MESSAGE_ID = 13888;
2464: public const ERROR_IPSEC_IKE_INVALID_AUTH_PAYLOAD = 13889;
2465: public const ERROR_IPSEC_IKE_DOS_COOKIE_SENT = 13890;
2466: public const ERROR_IPSEC_IKE_SHUTTING_DOWN = 13891;
2467: public const ERROR_IPSEC_IKE_CGA_AUTH_FAILED = 13892;
2468: public const ERROR_IPSEC_IKE_PROCESS_ERR_NATOA = 13893;
2469: public const ERROR_IPSEC_IKE_INVALID_MM_FOR_QM = 13894;
2470: public const ERROR_IPSEC_IKE_QM_EXPIRED = 13895;
2471: public const ERROR_IPSEC_IKE_TOO_MANY_FILTERS = 13896;
2472: public const ERROR_IPSEC_IKE_NEG_STATUS_END = 13897;
2473: public const ERROR_IPSEC_IKE_KILL_DUMMY_NAP_TUNNEL = 13898;
2474: public const ERROR_IPSEC_IKE_INNER_IP_ASSIGNMENT_FAILURE = 13899;
2475: public const ERROR_IPSEC_IKE_REQUIRE_CP_PAYLOAD_MISSING = 13900;
2476: public const ERROR_IPSEC_KEY_MODULE_IMPERSONATION_NEGOTIATION_PENDING = 13901;
2477: public const ERROR_IPSEC_IKE_COEXISTENCE_SUPPRESS = 13902;
2478: public const ERROR_IPSEC_IKE_RATELIMIT_DROP = 13903;
2479: public const ERROR_IPSEC_IKE_PEER_DOESNT_SUPPORT_MOBIKE = 13904;
2480: public const ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE = 13905;
2481: public const ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_FAILURE = 13906;
2482: public const ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE_WITH_OPTIONAL_RETRY = 13907;
2483: public const ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_AND_CERTMAP_FAILURE = 13908;
2484: public const ERROR_IPSEC_IKE_NEG_STATUS_EXTENDED_END = 13909;
2485: public const ERROR_IPSEC_BAD_SPI = 13910;
2486: public const ERROR_IPSEC_SA_LIFETIME_EXPIRED = 13911;
2487: public const ERROR_IPSEC_WRONG_SA = 13912;
2488: public const ERROR_IPSEC_REPLAY_CHECK_FAILED = 13913;
2489: public const ERROR_IPSEC_INVALID_PACKET = 13914;
2490: public const ERROR_IPSEC_INTEGRITY_CHECK_FAILED = 13915;
2491: public const ERROR_IPSEC_CLEAR_TEXT_DROP = 13916;
2492: public const ERROR_IPSEC_AUTH_FIREWALL_DROP = 13917;
2493: public const ERROR_IPSEC_THROTTLE_DROP = 13918;
2494: public const ERROR_IPSEC_DOSP_BLOCK = 13925;
2495: public const ERROR_IPSEC_DOSP_RECEIVED_MULTICAST = 13926;
2496: public const ERROR_IPSEC_DOSP_INVALID_PACKET = 13927;
2497: public const ERROR_IPSEC_DOSP_STATE_LOOKUP_FAILED = 13928;
2498: public const ERROR_IPSEC_DOSP_MAX_ENTRIES = 13929;
2499: public const ERROR_IPSEC_DOSP_KEYMOD_NOT_ALLOWED = 13930;
2500: public const ERROR_IPSEC_DOSP_NOT_INSTALLED = 13931;
2501: public const ERROR_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES = 13932;
2502: public const ERROR_SXS_SECTION_NOT_FOUND = 14000;
2503: public const ERROR_SXS_CANT_GEN_ACTCTX = 14001;
2504: public const ERROR_SXS_INVALID_ACTCTXDATA_FORMAT = 14002;
2505: public const ERROR_SXS_ASSEMBLY_NOT_FOUND = 14003;
2506: public const ERROR_SXS_MANIFEST_FORMAT_ERROR = 14004;
2507: public const ERROR_SXS_MANIFEST_PARSE_ERROR = 14005;
2508: public const ERROR_SXS_ACTIVATION_CONTEXT_DISABLED = 14006;
2509: public const ERROR_SXS_KEY_NOT_FOUND = 14007;
2510: public const ERROR_SXS_VERSION_CONFLICT = 14008;
2511: public const ERROR_SXS_WRONG_SECTION_TYPE = 14009;
2512: public const ERROR_SXS_THREAD_QUERIES_DISABLED = 14010;
2513: public const ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET = 14011;
2514: public const ERROR_SXS_UNKNOWN_ENCODING_GROUP = 14012;
2515: public const ERROR_SXS_UNKNOWN_ENCODING = 14013;
2516: public const ERROR_SXS_INVALID_XML_NAMESPACE_URI = 14014;
2517: public const ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14015;
2518: public const ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED = 14016;
2519: public const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE = 14017;
2520: public const ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE = 14018;
2521: public const ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE = 14019;
2522: public const ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT = 14020;
2523: public const ERROR_SXS_DUPLICATE_DLL_NAME = 14021;
2524: public const ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME = 14022;
2525: public const ERROR_SXS_DUPLICATE_CLSID = 14023;
2526: public const ERROR_SXS_DUPLICATE_IID = 14024;
2527: public const ERROR_SXS_DUPLICATE_TLBID = 14025;
2528: public const ERROR_SXS_DUPLICATE_PROGID = 14026;
2529: public const ERROR_SXS_DUPLICATE_ASSEMBLY_NAME = 14027;
2530: public const ERROR_SXS_FILE_HASH_MISMATCH = 14028;
2531: public const ERROR_SXS_POLICY_PARSE_ERROR = 14029;
2532: public const ERROR_SXS_XML_E_MISSINGQUOTE = 14030;
2533: public const ERROR_SXS_XML_E_COMMENTSYNTAX = 14031;
2534: public const ERROR_SXS_XML_E_BADSTARTNAMECHAR = 14032;
2535: public const ERROR_SXS_XML_E_BADNAMECHAR = 14033;
2536: public const ERROR_SXS_XML_E_BADCHARINSTRING = 14034;
2537: public const ERROR_SXS_XML_E_XMLDECLSYNTAX = 14035;
2538: public const ERROR_SXS_XML_E_BADCHARDATA = 14036;
2539: public const ERROR_SXS_XML_E_MISSINGWHITESPACE = 14037;
2540: public const ERROR_SXS_XML_E_EXPECTINGTAGEND = 14038;
2541: public const ERROR_SXS_XML_E_MISSINGSEMICOLON = 14039;
2542: public const ERROR_SXS_XML_E_UNBALANCEDPAREN = 14040;
2543: public const ERROR_SXS_XML_E_INTERNALERROR = 14041;
2544: public const ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE = 14042;
2545: public const ERROR_SXS_XML_E_INCOMPLETE_ENCODING = 14043;
2546: public const ERROR_SXS_XML_E_MISSING_PAREN = 14044;
2547: public const ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE = 14045;
2548: public const ERROR_SXS_XML_E_MULTIPLE_COLONS = 14046;
2549: public const ERROR_SXS_XML_E_INVALID_DECIMAL = 14047;
2550: public const ERROR_SXS_XML_E_INVALID_HEXIDECIMAL = 14048;
2551: public const ERROR_SXS_XML_E_INVALID_UNICODE = 14049;
2552: public const ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK = 14050;
2553: public const ERROR_SXS_XML_E_UNEXPECTEDENDTAG = 14051;
2554: public const ERROR_SXS_XML_E_UNCLOSEDTAG = 14052;
2555: public const ERROR_SXS_XML_E_DUPLICATEATTRIBUTE = 14053;
2556: public const ERROR_SXS_XML_E_MULTIPLEROOTS = 14054;
2557: public const ERROR_SXS_XML_E_INVALIDATROOTLEVEL = 14055;
2558: public const ERROR_SXS_XML_E_BADXMLDECL = 14056;
2559: public const ERROR_SXS_XML_E_MISSINGROOT = 14057;
2560: public const ERROR_SXS_XML_E_UNEXPECTEDEOF = 14058;
2561: public const ERROR_SXS_XML_E_BADPEREFINSUBSET = 14059;
2562: public const ERROR_SXS_XML_E_UNCLOSEDSTARTTAG = 14060;
2563: public const ERROR_SXS_XML_E_UNCLOSEDENDTAG = 14061;
2564: public const ERROR_SXS_XML_E_UNCLOSEDSTRING = 14062;
2565: public const ERROR_SXS_XML_E_UNCLOSEDCOMMENT = 14063;
2566: public const ERROR_SXS_XML_E_UNCLOSEDDECL = 14064;
2567: public const ERROR_SXS_XML_E_UNCLOSEDCDATA = 14065;
2568: public const ERROR_SXS_XML_E_RESERVEDNAMESPACE = 14066;
2569: public const ERROR_SXS_XML_E_INVALIDENCODING = 14067;
2570: public const ERROR_SXS_XML_E_INVALIDSWITCH = 14068;
2571: public const ERROR_SXS_XML_E_BADXMLCASE = 14069;
2572: public const ERROR_SXS_XML_E_INVALID_STANDALONE = 14070;
2573: public const ERROR_SXS_XML_E_UNEXPECTED_STANDALONE = 14071;
2574: public const ERROR_SXS_XML_E_INVALID_VERSION = 14072;
2575: public const ERROR_SXS_XML_E_MISSINGEQUALS = 14073;
2576: public const ERROR_SXS_PROTECTION_RECOVERY_FAILED = 14074;
2577: public const ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT = 14075;
2578: public const ERROR_SXS_PROTECTION_CATALOG_NOT_VALID = 14076;
2579: public const ERROR_SXS_UNTRANSLATABLE_HRESULT = 14077;
2580: public const ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING = 14078;
2581: public const ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE = 14079;
2582: public const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME = 14080;
2583: public const ERROR_SXS_ASSEMBLY_MISSING = 14081;
2584: public const ERROR_SXS_CORRUPT_ACTIVATION_STACK = 14082;
2585: public const ERROR_SXS_CORRUPTION = 14083;
2586: public const ERROR_SXS_EARLY_DEACTIVATION = 14084;
2587: public const ERROR_SXS_INVALID_DEACTIVATION = 14085;
2588: public const ERROR_SXS_MULTIPLE_DEACTIVATION = 14086;
2589: public const ERROR_SXS_PROCESS_TERMINATION_REQUESTED = 14087;
2590: public const ERROR_SXS_RELEASE_ACTIVATION_CONTEXT = 14088;
2591: public const ERROR_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY = 14089;
2592: public const ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE = 14090;
2593: public const ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME = 14091;
2594: public const ERROR_SXS_IDENTITY_DUPLICATE_ATTRIBUTE = 14092;
2595: public const ERROR_SXS_IDENTITY_PARSE_ERROR = 14093;
2596: public const ERROR_MALFORMED_SUBSTITUTION_STRING = 14094;
2597: public const ERROR_SXS_INCORRECT_PUBLIC_KEY_TOKEN = 14095;
2598: public const ERROR_UNMAPPED_SUBSTITUTION_STRING = 14096;
2599: public const ERROR_SXS_ASSEMBLY_NOT_LOCKED = 14097;
2600: public const ERROR_SXS_COMPONENT_STORE_CORRUPT = 14098;
2601: public const ERROR_ADVANCED_INSTALLER_FAILED = 14099;
2602: public const ERROR_XML_ENCODING_MISMATCH = 14100;
2603: public const ERROR_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT = 14101;
2604: public const ERROR_SXS_IDENTITIES_DIFFERENT = 14102;
2605: public const ERROR_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT = 14103;
2606: public const ERROR_SXS_FILE_NOT_PART_OF_ASSEMBLY = 14104;
2607: public const ERROR_SXS_MANIFEST_TOO_BIG = 14105;
2608: public const ERROR_SXS_SETTING_NOT_REGISTERED = 14106;
2609: public const ERROR_SXS_TRANSACTION_CLOSURE_INCOMPLETE = 14107;
2610: public const ERROR_SMI_PRIMITIVE_INSTALLER_FAILED = 14108;
2611: public const ERROR_GENERIC_COMMAND_FAILED = 14109;
2612: public const ERROR_SXS_FILE_HASH_MISSING = 14110;
2613: public const ERROR_EVT_INVALID_CHANNEL_PATH = 15000;
2614: public const ERROR_EVT_INVALID_QUERY = 15001;
2615: public const ERROR_EVT_PUBLISHER_METADATA_NOT_FOUND = 15002;
2616: public const ERROR_EVT_EVENT_TEMPLATE_NOT_FOUND = 15003;
2617: public const ERROR_EVT_INVALID_PUBLISHER_NAME = 15004;
2618: public const ERROR_EVT_INVALID_EVENT_DATA = 15005;
2619: public const ERROR_EVT_CHANNEL_NOT_FOUND = 15007;
2620: public const ERROR_EVT_MALFORMED_XML_TEXT = 15008;
2621: public const ERROR_EVT_SUBSCRIPTION_TO_DIRECT_CHANNEL = 15009;
2622: public const ERROR_EVT_CONFIGURATION_ERROR = 15010;
2623: public const ERROR_EVT_QUERY_RESULT_STALE = 15011;
2624: public const ERROR_EVT_QUERY_RESULT_INVALID_POSITION = 15012;
2625: public const ERROR_EVT_NON_VALIDATING_MSXML = 15013;
2626: public const ERROR_EVT_FILTER_ALREADYSCOPED = 15014;
2627: public const ERROR_EVT_FILTER_NOTELTSET = 15015;
2628: public const ERROR_EVT_FILTER_INVARG = 15016;
2629: public const ERROR_EVT_FILTER_INVTEST = 15017;
2630: public const ERROR_EVT_FILTER_INVTYPE = 15018;
2631: public const ERROR_EVT_FILTER_PARSEERR = 15019;
2632: public const ERROR_EVT_FILTER_UNSUPPORTEDOP = 15020;
2633: public const ERROR_EVT_FILTER_UNEXPECTEDTOKEN = 15021;
2634: public const ERROR_EVT_INVALID_OPERATION_OVER_ENABLED_DIRECT_CHANNEL = 15022;
2635: public const ERROR_EVT_INVALID_CHANNEL_PROPERTY_VALUE = 15023;
2636: public const ERROR_EVT_INVALID_PUBLISHER_PROPERTY_VALUE = 15024;
2637: public const ERROR_EVT_CHANNEL_CANNOT_ACTIVATE = 15025;
2638: public const ERROR_EVT_FILTER_TOO_COMPLEX = 15026;
2639: public const ERROR_EVT_MESSAGE_NOT_FOUND = 15027;
2640: public const ERROR_EVT_MESSAGE_ID_NOT_FOUND = 15028;
2641: public const ERROR_EVT_UNRESOLVED_VALUE_INSERT = 15029;
2642: public const ERROR_EVT_UNRESOLVED_PARAMETER_INSERT = 15030;
2643: public const ERROR_EVT_MAX_INSERTS_REACHED = 15031;
2644: public const ERROR_EVT_EVENT_DEFINITION_NOT_FOUND = 15032;
2645: public const ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND = 15033;
2646: public const ERROR_EVT_VERSION_TOO_OLD = 15034;
2647: public const ERROR_EVT_VERSION_TOO_NEW = 15035;
2648: public const ERROR_EVT_CANNOT_OPEN_CHANNEL_OF_QUERY = 15036;
2649: public const ERROR_EVT_PUBLISHER_DISABLED = 15037;
2650: public const ERROR_EVT_FILTER_OUT_OF_RANGE = 15038;
2651: public const ERROR_EC_SUBSCRIPTION_CANNOT_ACTIVATE = 15080;
2652: public const ERROR_EC_LOG_DISABLED = 15081;
2653: public const ERROR_EC_CIRCULAR_FORWARDING = 15082;
2654: public const ERROR_EC_CREDSTORE_FULL = 15083;
2655: public const ERROR_EC_CRED_NOT_FOUND = 15084;
2656: public const ERROR_EC_NO_ACTIVE_CHANNEL = 15085;
2657: public const ERROR_MUI_FILE_NOT_FOUND = 15100;
2658: public const ERROR_MUI_INVALID_FILE = 15101;
2659: public const ERROR_MUI_INVALID_RC_CONFIG = 15102;
2660: public const ERROR_MUI_INVALID_LOCALE_NAME = 15103;
2661: public const ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME = 15104;
2662: public const ERROR_MUI_FILE_NOT_LOADED = 15105;
2663: public const ERROR_RESOURCE_ENUM_USER_STOP = 15106;
2664: public const ERROR_MUI_INTLSETTINGS_UILANG_NOT_INSTALLED = 15107;
2665: public const ERROR_MUI_INTLSETTINGS_INVALID_LOCALE_NAME = 15108;
2666: public const ERROR_MRM_RUNTIME_NO_DEFAULT_OR_NEUTRAL_RESOURCE = 15110;
2667: public const ERROR_MRM_INVALID_PRICONFIG = 15111;
2668: public const ERROR_MRM_INVALID_FILE_TYPE = 15112;
2669: public const ERROR_MRM_UNKNOWN_QUALIFIER = 15113;
2670: public const ERROR_MRM_INVALID_QUALIFIER_VALUE = 15114;
2671: public const ERROR_MRM_NO_CANDIDATE = 15115;
2672: public const ERROR_MRM_NO_MATCH_OR_DEFAULT_CANDIDATE = 15116;
2673: public const ERROR_MRM_RESOURCE_TYPE_MISMATCH = 15117;
2674: public const ERROR_MRM_DUPLICATE_MAP_NAME = 15118;
2675: public const ERROR_MRM_DUPLICATE_ENTRY = 15119;
2676: public const ERROR_MRM_INVALID_RESOURCE_IDENTIFIER = 15120;
2677: public const ERROR_MRM_FILEPATH_TOO_LONG = 15121;
2678: public const ERROR_MRM_UNSUPPORTED_DIRECTORY_TYPE = 15122;
2679: public const ERROR_MRM_INVALID_PRI_FILE = 15126;
2680: public const ERROR_MRM_NAMED_RESOURCE_NOT_FOUND = 15127;
2681: public const ERROR_MRM_MAP_NOT_FOUND = 15135;
2682: public const ERROR_MRM_UNSUPPORTED_PROFILE_TYPE = 15136;
2683: public const ERROR_MRM_INVALID_QUALIFIER_OPERATOR = 15137;
2684: public const ERROR_MRM_INDETERMINATE_QUALIFIER_VALUE = 15138;
2685: public const ERROR_MRM_AUTOMERGE_ENABLED = 15139;
2686: public const ERROR_MRM_TOO_MANY_RESOURCES = 15140;
2687: public const ERROR_MCA_INVALID_CAPABILITIES_STRING = 15200;
2688: public const ERROR_MCA_INVALID_VCP_VERSION = 15201;
2689: public const ERROR_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION = 15202;
2690: public const ERROR_MCA_MCCS_VERSION_MISMATCH = 15203;
2691: public const ERROR_MCA_UNSUPPORTED_MCCS_VERSION = 15204;
2692: public const ERROR_MCA_INTERNAL_ERROR = 15205;
2693: public const ERROR_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED = 15206;
2694: public const ERROR_MCA_UNSUPPORTED_COLOR_TEMPERATURE = 15207;
2695: public const ERROR_AMBIGUOUS_SYSTEM_DEVICE = 15250;
2696: public const ERROR_SYSTEM_DEVICE_NOT_FOUND = 15299;
2697: public const ERROR_HASH_NOT_SUPPORTED = 15300;
2698: public const ERROR_HASH_NOT_PRESENT = 15301;
2699: public const ERROR_SECONDARY_IC_PROVIDER_NOT_REGISTERED = 15321;
2700: public const ERROR_GPIO_CLIENT_INFORMATION_INVALID = 15322;
2701: public const ERROR_GPIO_VERSION_NOT_SUPPORTED = 15323;
2702: public const ERROR_GPIO_INVALID_REGISTRATION_PACKET = 15324;
2703: public const ERROR_GPIO_OPERATION_DENIED = 15325;
2704: public const ERROR_GPIO_INCOMPATIBLE_CONNECT_MODE = 15326;
2705: public const ERROR_GPIO_INTERRUPT_ALREADY_UNMASKED = 15327;
2706: public const ERROR_CANNOT_SWITCH_RUNLEVEL = 15400;
2707: public const ERROR_INVALID_RUNLEVEL_SETTING = 15401;
2708: public const ERROR_RUNLEVEL_SWITCH_TIMEOUT = 15402;
2709: public const ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT = 15403;
2710: public const ERROR_RUNLEVEL_SWITCH_IN_PROGRESS = 15404;
2711: public const ERROR_SERVICES_FAILED_AUTOSTART = 15405;
2712: public const ERROR_COM_TASK_STOP_PENDING = 15501;
2713: public const ERROR_INSTALL_OPEN_PACKAGE_FAILED = 15600;
2714: public const ERROR_INSTALL_PACKAGE_NOT_FOUND = 15601;
2715: public const ERROR_INSTALL_INVALID_PACKAGE = 15602;
2716: public const ERROR_INSTALL_RESOLVE_DEPENDENCY_FAILED = 15603;
2717: public const ERROR_INSTALL_OUT_OF_DISK_SPACE = 15604;
2718: public const ERROR_INSTALL_NETWORK_FAILURE = 15605;
2719: public const ERROR_INSTALL_REGISTRATION_FAILURE = 15606;
2720: public const ERROR_INSTALL_DEREGISTRATION_FAILURE = 15607;
2721: public const ERROR_INSTALL_CANCEL = 15608;
2722: public const ERROR_INSTALL_FAILED = 15609;
2723: public const ERROR_REMOVE_FAILED = 15610;
2724: public const ERROR_PACKAGE_ALREADY_EXISTS = 15611;
2725: public const ERROR_NEEDS_REMEDIATION = 15612;
2726: public const ERROR_INSTALL_PREREQUISITE_FAILED = 15613;
2727: public const ERROR_PACKAGE_REPOSITORY_CORRUPTED = 15614;
2728: public const ERROR_INSTALL_POLICY_FAILURE = 15615;
2729: public const ERROR_PACKAGE_UPDATING = 15616;
2730: public const ERROR_DEPLOYMENT_BLOCKED_BY_POLICY = 15617;
2731: public const ERROR_PACKAGES_IN_USE = 15618;
2732: public const ERROR_RECOVERY_FILE_CORRUPT = 15619;
2733: public const ERROR_INVALID_STAGED_SIGNATURE = 15620;
2734: public const ERROR_DELETING_EXISTING_APPLICATIONDATA_STORE_FAILED = 15621;
2735: public const ERROR_INSTALL_PACKAGE_DOWNGRADE = 15622;
2736: public const ERROR_SYSTEM_NEEDS_REMEDIATION = 15623;
2737: public const ERROR_APPX_INTEGRITY_FAILURE_CLR_NGEN = 15624;
2738: public const ERROR_RESILIENCY_FILE_CORRUPT = 15625;
2739: public const ERROR_INSTALL_FIREWALL_SERVICE_NOT_RUNNING = 15626;
2740: public const APPMODEL_ERROR_NO_PACKAGE = 15700;
2741: public const APPMODEL_ERROR_PACKAGE_RUNTIME_CORRUPT = 15701;
2742: public const APPMODEL_ERROR_PACKAGE_IDENTITY_CORRUPT = 15702;
2743: public const APPMODEL_ERROR_NO_APPLICATION = 15703;
2744: public const ERROR_STATE_LOAD_STORE_FAILED = 15800;
2745: public const ERROR_STATE_GET_VERSION_FAILED = 15801;
2746: public const ERROR_STATE_SET_VERSION_FAILED = 15802;
2747: public const ERROR_STATE_STRUCTURED_RESET_FAILED = 15803;
2748: public const ERROR_STATE_OPEN_CONTAINER_FAILED = 15804;
2749: public const ERROR_STATE_CREATE_CONTAINER_FAILED = 15805;
2750: public const ERROR_STATE_DELETE_CONTAINER_FAILED = 15806;
2751: public const ERROR_STATE_READ_SETTING_FAILED = 15807;
2752: public const ERROR_STATE_WRITE_SETTING_FAILED = 15808;
2753: public const ERROR_STATE_DELETE_SETTING_FAILED = 15809;
2754: public const ERROR_STATE_QUERY_SETTING_FAILED = 15810;
2755: public const ERROR_STATE_READ_COMPOSITE_SETTING_FAILED = 15811;
2756: public const ERROR_STATE_WRITE_COMPOSITE_SETTING_FAILED = 15812;
2757: public const ERROR_STATE_ENUMERATE_CONTAINER_FAILED = 15813;
2758: public const ERROR_STATE_ENUMERATE_SETTINGS_FAILED = 15814;
2759: public const ERROR_STATE_COMPOSITE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED = 15815;
2760: public const ERROR_STATE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED = 15816;
2761: public const ERROR_STATE_SETTING_NAME_SIZE_LIMIT_EXCEEDED = 15817;
2762: public const ERROR_STATE_CONTAINER_NAME_SIZE_LIMIT_EXCEEDED = 15818;
2763: public const ERROR_API_UNAVAILABLE = 15841;
2764:
2765: public function getDescription(): string
2766: {
2767: return ucfirst(preg_replace('/^error /', '', str_replace(
2768: ['crc', 'dos', 'eof', 'sem_', 'iopl', 'eas', 'ea_', 'rpc', 'dns', 'frs', '_'],
2769: ['CRC', 'DOS', 'EOF', 'SEM ', 'IOPL', 'EAS', 'EA ', 'RPC', 'DNS', 'FRS', ' '],
2770: strtolower($this->getConstantName())
2771: )));
2772: }
2773:
2774: }
| 0 % | System\Php.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\System;
11:
12: class Php
13: {
14: use \Dogma\StaticClassMixin;
15:
16: public static function is32bit(): bool
17: {
18: return PHP_INT_SIZE < 8;
19: }
20:
21: public static function is64bit(): bool
22: {
23: return PHP_INT_SIZE === 8;
24: }
25:
26: public static function getSapi(): Sapi
27: {
28: return Sapi::get(php_sapi_name());
29: }
30:
31: public static function isMultithreaded(): bool
32: {
33: return self::getSapi()->isMultithreaded() || self::hasPthreads() || self::isThreadSafe();
34: }
35:
36: public static function hasPthreads(): bool
37: {
38: return extension_loaded('pthreads');
39: }
40:
41: public static function isThreadSafe(): bool
42: {
43: static $threadSafe;
44: if ($threadSafe === null) {
45: ob_start();
46: phpinfo(INFO_GENERAL);
47: $info = ob_get_clean();
48: $threadSafe = (bool) preg_match('~Thread Safety\s*</td>\s*<td[^>]*>\s*enabled~', $info);
49: }
50:
51: return $threadSafe;
52: }
53:
54: }
| 0 % | System\Port.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\System;
4:
5: /**
6: * IANA RFC6335 assigned port numbers
7: */
8: class Port extends \Dogma\Enum\PartialIntEnum
9: {
10:
11: public const TCPMUX = 1;
12: public const COMPRESSNET = 2;
13: public const COMPRESSNET_2 = 3;
14: public const RJE = 5;
15: public const ECHO = 7;
16: public const DISCARD = 9;
17: public const SYSTAT = 11;
18: public const DAYTIME = 13;
19: public const QOTD = 17;
20: public const MSP = 18;
21: public const CHARGEN = 19;
22: public const FTP_DATA = 20;
23: public const FTP = 21;
24: public const SSH = 22;
25: public const TELNET = 23;
26: public const SMTP = 25;
27: public const NSW_FE = 27;
28: public const MSG_ICP = 29;
29: public const MSG_AUTH = 31;
30: public const DSP = 33;
31: public const TIME = 37;
32: public const RAP = 38;
33: public const RLP = 39;
34: public const GRAPHICS = 41;
35: public const NAME = 42;
36: public const NAMESERVER = 42;
37: public const NICNAME = 43;
38: public const MPM_FLAGS = 44;
39: public const MPM = 45;
40: public const MPM_SND = 46;
41: public const AUDITD = 48;
42: public const TACACS = 49;
43: public const RE_MAIL_CK = 50;
44: public const XNS_TIME = 52;
45: public const DOMAIN = 53;
46: public const XNS_CH = 54;
47: public const ISI_GL = 55;
48: public const XNS_AUTH = 56;
49: public const XNS_MAIL = 58;
50: public const ACAS = 62;
51: public const WHOISPP = 63;
52: public const COVIA = 64;
53: public const TACACS_DS = 65;
54: public const SQL_NET = 66;
55: public const BOOTPS = 67;
56: public const BOOTPC = 68;
57: public const TFTP = 69;
58: public const GOPHER = 70;
59: public const NETRJS_1 = 71;
60: public const NETRJS_2 = 72;
61: public const NETRJS_3 = 73;
62: public const NETRJS_4 = 74;
63: public const DEOS = 76;
64: public const VETTCP = 78;
65: public const FINGER = 79;
66: public const HTTP = 80;
67: public const WWW = 80;
68: public const WWW_HTTP = 80;
69: public const XFER = 82;
70: public const MIT_ML_DEV = 83;
71: public const CTF = 84;
72: public const MIT_ML_DEV_2 = 85;
73: public const MFCOBOL = 86;
74: public const KERBEROS = 88;
75: public const SU_MIT_TG = 89;
76: public const DNSIX = 90;
77: public const MIT_DOV = 91;
78: public const NPP = 92;
79: public const DCP = 93;
80: public const OBJCALL = 94;
81: public const SUPDUP = 95;
82: public const DIXIE = 96;
83: public const SWIFT_RVF = 97;
84: public const TACNEWS = 98;
85: public const METAGRAM = 99;
86: public const HOSTNAME = 101;
87: public const ISO_TSAP = 102;
88: public const GPPITNP = 103;
89: public const ACR_NEMA = 104;
90: public const CSO = 105;
91: public const CSNET_NS = 105;
92: public const _3COM_TSMUX = 106;
93: public const RTELNET = 107;
94: public const SNAGAS = 108;
95: public const POP2 = 109;
96: public const POP3 = 110;
97: public const SUNRPC = 111;
98: public const MCIDAS = 112;
99: public const IDENT = 113;
100: public const AUTH = 113;
101: public const SFTP = 115;
102: public const ANSANOTIFY = 116;
103: public const UUCP_PATH = 117;
104: public const SQLSERV = 118;
105: public const NNTP = 119;
106: public const CFDPTKT = 120;
107: public const ERPC = 121;
108: public const SMAKYNET = 122;
109: public const NTP = 123;
110: public const ANSATRADER = 124;
111: public const LOCUS_MAP = 125;
112: public const NXEDIT = 126;
113: public const LOCUS_CON = 127;
114: public const GSS_XLICEN = 128;
115: public const PWDGEN = 129;
116: public const CISCO_FNA = 130;
117: public const CISCO_TNA = 131;
118: public const CISCO_SYS = 132;
119: public const STATSRV = 133;
120: public const INGRES_NET = 134;
121: public const EPMAP = 135;
122: public const PROFILE = 136;
123: public const NETBIOS_NS = 137;
124: public const NETBIOS_DGM = 138;
125: public const NETBIOS_SSN = 139;
126: public const EMFIS_DATA = 140;
127: public const EMFIS_CNTL = 141;
128: public const BL_IDM = 142;
129: public const IMAP = 143;
130: public const UMA = 144;
131: public const UAAC = 145;
132: public const ISO_TP0 = 146;
133: public const ISO_IP = 147;
134: public const JARGON = 148;
135: public const AED_512 = 149;
136: public const SQL_NET_2 = 150;
137: public const HEMS = 151;
138: public const BFTP = 152;
139: public const SGMP = 153;
140: public const NETSC_PROD = 154;
141: public const NETSC_DEV = 155;
142: public const SQLSRV = 156;
143: public const KNET_CMP = 157;
144: public const PCMAIL_SRV = 158;
145: public const NSS_ROUTING = 159;
146: public const SGMP_TRAPS = 160;
147: public const SNMP = 161;
148: public const SNMPTRAP = 162;
149: public const CMIP_MAN = 163;
150: public const CMIP_AGENT = 164;
151: public const XNS_COURIER = 165;
152: public const S_NET = 166;
153: public const NAMP = 167;
154: public const RSVD = 168;
155: public const SEND = 169;
156: public const PRINT_SRV = 170;
157: public const MULTIPLEX = 171;
158: public const CL_1 = 172;
159: public const XYPLEX_MUX = 173;
160: public const MAILQ = 174;
161: public const VMNET = 175;
162: public const GENRAD_MUX = 176;
163: public const XDMCP = 177;
164: public const NEXTSTEP = 178;
165: public const BGP = 179;
166: public const RIS = 180;
167: public const UNIFY = 181;
168: public const AUDIT = 182;
169: public const OCBINDER = 183;
170: public const OCSERVER = 184;
171: public const REMOTE_KIS = 185;
172: public const KIS = 186;
173: public const ACI = 187;
174: public const MUMPS = 188;
175: public const QFT = 189;
176: public const GACP = 190;
177: public const PROSPERO = 191;
178: public const OSU_NMS = 192;
179: public const SRMP = 193;
180: public const IRC = 194;
181: public const DN6_NLM_AUD = 195;
182: public const DN6_SMM_RED = 196;
183: public const DLS = 197;
184: public const DLS_MON = 198;
185: public const SMUX = 199;
186: public const SRC = 200;
187: public const AT_RTMP = 201;
188: public const AT_NBP = 202;
189: public const AT_3 = 203;
190: public const AT_ECHO = 204;
191: public const AT_5 = 205;
192: public const AT_ZIS = 206;
193: public const AT_7 = 207;
194: public const AT_8 = 208;
195: public const QMTP = 209;
196: public const Z39_50 = 210;
197: public const _914C_G = 211;
198: public const ANET = 212;
199: public const IPX = 213;
200: public const VMPWSCS = 214;
201: public const SOFTPC = 215;
202: public const CAILIC = 216;
203: public const DBASE = 217;
204: public const MPP = 218;
205: public const UARPS = 219;
206: public const IMAP3 = 220;
207: public const FLN_SPX = 221;
208: public const RSH_SPX = 222;
209: public const CDC = 223;
210: public const MASQDIALER = 224;
211: public const DIRECT = 242;
212: public const SUR_MEAS = 243;
213: public const INBUSINESS = 244;
214: public const LINK = 245;
215: public const DSP3270 = 246;
216: public const SUBNTBCST_TFTP = 247;
217: public const BHFHS = 248;
218: public const RAP_2 = 256;
219: public const SET = 257;
220: public const ESRO_GEN = 259;
221: public const OPENPORT = 260;
222: public const NSIIOPS = 261;
223: public const ARCISDMS = 262;
224: public const HDAP = 263;
225: public const BGMP = 264;
226: public const X_BONE_CTL = 265;
227: public const SST = 266;
228: public const TD_SERVICE = 267;
229: public const TD_REPLICA = 268;
230: public const MANET = 269;
231: public const PT_TLS = 271;
232: public const HTTP_MGMT = 280;
233: public const PERSONAL_LINK = 281;
234: public const CABLEPORT_AX = 282;
235: public const RESCAP = 283;
236: public const CORERJD = 284;
237: public const FXP = 286;
238: public const K_BLOCK = 287;
239: public const NOVASTORBAKCUP = 308;
240: public const ENTRUSTTIME = 309;
241: public const BHMDS = 310;
242: public const ASIP_WEBADMIN = 311;
243: public const VSLMP = 312;
244: public const MAGENTA_LOGIC = 313;
245: public const OPALIS_ROBOT = 314;
246: public const DPSI = 315;
247: public const DECAUTH = 316;
248: public const ZANNET = 317;
249: public const PKIX_TIMESTAMP = 318;
250: public const PTP_EVENT = 319;
251: public const PTP_GENERAL = 320;
252: public const PIP = 321;
253: public const RTSPS = 322;
254: public const RPKI_RTR = 323;
255: public const RPKI_RTR_TLS = 324;
256: public const TEXAR = 333;
257: public const PDAP = 344;
258: public const PAWSERV = 345;
259: public const ZSERV = 346;
260: public const FATSERV = 347;
261: public const CSI_SGWP = 348;
262: public const MFTP = 349;
263: public const MATIP_TYPE_A = 350;
264: public const MATIP_TYPE_B = 351;
265: public const BHOETTY = 351;
266: public const DTAG_STE_SB = 352;
267: public const BHOEDAP4 = 352;
268: public const NDSAUTH = 353;
269: public const BH611 = 354;
270: public const DATEX_ASN = 355;
271: public const CLOANTO_NET_1 = 356;
272: public const BHEVENT = 357;
273: public const SHRINKWRAP = 358;
274: public const NSRMP = 359;
275: public const SCOI2ODIALOG = 360;
276: public const SEMANTIX = 361;
277: public const SRSSEND = 362;
278: public const RSVP_TUNNEL = 363;
279: public const AURORA_CMGR = 364;
280: public const DTK = 365;
281: public const ODMR = 366;
282: public const MORTGAGEWARE = 367;
283: public const QBIKGDP = 368;
284: public const RPC2PORTMAP = 369;
285: public const CODAAUTH2 = 370;
286: public const CLEARCASE = 371;
287: public const ULISTPROC = 372;
288: public const LEGENT_1 = 373;
289: public const LEGENT_2 = 374;
290: public const HASSLE = 375;
291: public const NIP = 376;
292: public const TNETOS = 377;
293: public const DSETOS = 378;
294: public const IS99C = 379;
295: public const IS99S = 380;
296: public const HP_COLLECTOR = 381;
297: public const HP_MANAGED_NODE = 382;
298: public const HP_ALARM_MGR = 383;
299: public const ARNS = 384;
300: public const IBM_APP = 385;
301: public const ASA = 386;
302: public const AURP = 387;
303: public const UNIDATA_LDM = 388;
304: public const LDAP = 389;
305: public const UIS = 390;
306: public const SYNOTICS_RELAY = 391;
307: public const SYNOTICS_BROKER = 392;
308: public const META5 = 393;
309: public const EMBL_NDT = 394;
310: public const NETCP = 395;
311: public const NETWARE_IP = 396;
312: public const MPTN = 397;
313: public const KRYPTOLAN = 398;
314: public const ISO_TSAP_C2 = 399;
315: public const OSB_SD = 400;
316: public const UPS = 401;
317: public const GENIE = 402;
318: public const DECAP = 403;
319: public const NCED = 404;
320: public const NCLD = 405;
321: public const IMSP = 406;
322: public const TIMBUKTU = 407;
323: public const PRM_SM = 408;
324: public const PRM_NM = 409;
325: public const DECLADEBUG = 410;
326: public const RMT = 411;
327: public const SYNOPTICS_TRAP = 412;
328: public const SMSP = 413;
329: public const INFOSEEK = 414;
330: public const BNET = 415;
331: public const SILVERPLATTER = 416;
332: public const ONMUX = 417;
333: public const HYPER_G = 418;
334: public const ARIEL1 = 419;
335: public const SMPTE = 420;
336: public const ARIEL2 = 421;
337: public const ARIEL3 = 422;
338: public const OPC_JOB_START = 423;
339: public const OPC_JOB_TRACK = 424;
340: public const ICAD_EL = 425;
341: public const SMARTSDP = 426;
342: public const SVRLOC = 427;
343: public const OCS_CMU = 428;
344: public const OCS_AMU = 429;
345: public const UTMPSD = 430;
346: public const UTMPCD = 431;
347: public const IASD = 432;
348: public const NNSP = 433;
349: public const MOBILEIP_AGENT = 434;
350: public const MOBILIP_MN = 435;
351: public const DNA_CML = 436;
352: public const COMSCM = 437;
353: public const DSFGW = 438;
354: public const DASP = 439;
355: public const SGCP = 440;
356: public const DECVMS_SYSMGT = 441;
357: public const CVC_HOSTD = 442;
358: public const HTTPS = 443;
359: public const SNPP = 444;
360: public const MICROSOFT_DS = 445;
361: public const DDM_RDB = 446;
362: public const DDM_DFM = 447;
363: public const DDM_SSL = 448;
364: public const AS_SERVERMAP = 449;
365: public const TSERVER = 450;
366: public const SFS_SMP_NET = 451;
367: public const SFS_CONFIG = 452;
368: public const CREATIVESERVER = 453;
369: public const CONTENTSERVER = 454;
370: public const CREATIVEPARTNR = 455;
371: public const MACON_TCP = 456;
372: public const SCOHELP = 457;
373: public const APPLEQTC = 458;
374: public const AMPR_RCMD = 459;
375: public const SKRONK = 460;
376: public const DATASURFSRV = 461;
377: public const DATASURFSRVSEC = 462;
378: public const ALPES = 463;
379: public const KPASSWD = 464;
380: public const URD = 465;
381: public const SUBMISSIONS = 465;
382: public const DIGITAL_VRC = 466;
383: public const MYLEX_MAPD = 467;
384: public const PHOTURIS = 468;
385: public const RCP = 469;
386: public const SCX_PROXY = 470;
387: public const MONDEX = 471;
388: public const LJK_LOGIN = 472;
389: public const HYBRID_POP = 473;
390: public const TN_TL_W1 = 474;
391: public const TCPNETHASPSRV = 475;
392: public const TN_TL_FD1 = 476;
393: public const SS7NS = 477;
394: public const SPSC = 478;
395: public const IAFSERVER = 479;
396: public const IAFDBASE = 480;
397: public const PH = 481;
398: public const BGS_NSI = 482;
399: public const ULPNET = 483;
400: public const INTEGRA_SME = 484;
401: public const POWERBURST = 485;
402: public const AVIAN = 486;
403: public const SAFT = 487;
404: public const GSS_HTTP = 488;
405: public const NEST_PROTOCOL = 489;
406: public const MICOM_PFS = 490;
407: public const GO_LOGIN = 491;
408: public const TICF_1 = 492;
409: public const TICF_2 = 493;
410: public const POV_RAY = 494;
411: public const INTECOURIER = 495;
412: public const PIM_RP_DISC = 496;
413: public const RETROSPECT = 497;
414: public const SIAM = 498;
415: public const ISO_ILL = 499;
416: public const ISAKMP = 500;
417: public const STMF = 501;
418: public const MBAP = 502;
419: public const INTRINSA = 503;
420: public const CITADEL = 504;
421: public const MAILBOX_LM = 505;
422: public const OHIMSRV = 506;
423: public const CRS = 507;
424: public const XVTTP = 508;
425: public const SNARE = 509;
426: public const FCP = 510;
427: public const PASSGO = 511;
428: public const EXEC = 512;
429: public const LOGIN = 513;
430: public const SHELL = 514;
431: public const PRINTER = 515;
432: public const VIDEOTEX = 516;
433: public const TALK = 517;
434: public const NTALK = 518;
435: public const UTIME = 519;
436: public const EFS = 520;
437: public const RIPNG = 521;
438: public const ULP = 522;
439: public const IBM_DB2 = 523;
440: public const NCP = 524;
441: public const TIMED = 525;
442: public const TEMPO = 526;
443: public const STX = 527;
444: public const CUSTIX = 528;
445: public const IRC_SERV = 529;
446: public const COURIER = 530;
447: public const CONFERENCE = 531;
448: public const NETNEWS = 532;
449: public const NETWALL = 533;
450: public const WINDREAM = 534;
451: public const IIOP = 535;
452: public const OPALIS_RDV = 536;
453: public const NMSP = 537;
454: public const GDOMAP = 538;
455: public const APERTUS_LDP = 539;
456: public const UUCP = 540;
457: public const UUCP_RLOGIN = 541;
458: public const COMMERCE = 542;
459: public const KLOGIN = 543;
460: public const KSHELL = 544;
461: public const APPLEQTCSRVR = 545;
462: public const DHCPV6_CLIENT = 546;
463: public const DHCPV6_SERVER = 547;
464: public const AFPOVERTCP = 548;
465: public const IDFP = 549;
466: public const NEW_RWHO = 550;
467: public const CYBERCASH = 551;
468: public const DEVSHR_NTS = 552;
469: public const PIRP = 553;
470: public const RTSP = 554;
471: public const DSF = 555;
472: public const REMOTEFS = 556;
473: public const OPENVMS_SYSIPC = 557;
474: public const SDNSKMP = 558;
475: public const TEEDTAP = 559;
476: public const RMONITOR = 560;
477: public const MONITOR = 561;
478: public const CHSHELL = 562;
479: public const NNTPS = 563;
480: public const _9PFS = 564;
481: public const WHOAMI = 565;
482: public const STREETTALK = 566;
483: public const BANYAN_RPC = 567;
484: public const MS_SHUTTLE = 568;
485: public const MS_ROME = 569;
486: public const METER = 570;
487: public const METER_2 = 571;
488: public const SONAR = 572;
489: public const BANYAN_VIP = 573;
490: public const FTP_AGENT = 574;
491: public const VEMMI = 575;
492: public const IPCD = 576;
493: public const VNAS = 577;
494: public const IPDD = 578;
495: public const DECBSRV = 579;
496: public const SNTP_HEARTBEAT = 580;
497: public const BDP = 581;
498: public const SCC_SECURITY = 582;
499: public const PHILIPS_VC = 583;
500: public const KEYSERVER = 584;
501: public const PASSWORD_CHG = 586;
502: public const SUBMISSION = 587;
503: public const CAL = 588;
504: public const EYELINK = 589;
505: public const TNS_CML = 590;
506: public const HTTP_ALT = 591;
507: public const EUDORA_SET = 592;
508: public const HTTP_RPC_EPMAP = 593;
509: public const TPIP = 594;
510: public const CAB_PROTOCOL = 595;
511: public const SMSD = 596;
512: public const PTCNAMESERVICE = 597;
513: public const SCO_WEBSRVRMG3 = 598;
514: public const ACP = 599;
515: public const IPCSERVER = 600;
516: public const SYSLOG_CONN = 601;
517: public const XMLRPC_BEEP = 602;
518: public const IDXP = 603;
519: public const TUNNEL = 604;
520: public const SOAP_BEEP = 605;
521: public const URM = 606;
522: public const NQS = 607;
523: public const SIFT_UFT = 608;
524: public const NPMP_TRAP = 609;
525: public const NPMP_LOCAL = 610;
526: public const NPMP_GUI = 611;
527: public const HMMP_IND = 612;
528: public const HMMP_OP = 613;
529: public const SSHELL = 614;
530: public const SCO_INETMGR = 615;
531: public const SCO_SYSMGR = 616;
532: public const SCO_DTMGR = 617;
533: public const DEI_ICDA = 618;
534: public const COMPAQ_EVM = 619;
535: public const SCO_WEBSRVRMGR = 620;
536: public const ESCP_IP = 621;
537: public const COLLABORATOR = 622;
538: public const OOB_WS_HTTP = 623;
539: public const CRYPTOADMIN = 624;
540: public const DEC_DLM = 625;
541: public const ASIA = 626;
542: public const PASSGO_TIVOLI = 627;
543: public const QMQP = 628;
544: public const _3COM_AMP3 = 629;
545: public const RDA = 630;
546: public const IPP = 631;
547: public const BMPP = 632;
548: public const SERVSTAT = 633;
549: public const GINAD = 634;
550: public const RLZDBASE = 635;
551: public const LDAPS = 636;
552: public const LANSERVER = 637;
553: public const MCNS_SEC = 638;
554: public const MSDP = 639;
555: public const ENTRUST_SPS = 640;
556: public const REPCMD = 641;
557: public const ESRO_EMSDP = 642;
558: public const SANITY = 643;
559: public const DWR = 644;
560: public const PSSC = 645;
561: public const LDP = 646;
562: public const DHCP_FAILOVER = 647;
563: public const RRP = 648;
564: public const CADVIEW_3D = 649;
565: public const OBEX = 650;
566: public const IEEE_MMS = 651;
567: public const HELLO_PORT = 652;
568: public const REPSCMD = 653;
569: public const AODV = 654;
570: public const TINC = 655;
571: public const SPMP = 656;
572: public const RMC = 657;
573: public const TENFOLD = 658;
574: public const MAC_SRVR_ADMIN = 660;
575: public const HAP = 661;
576: public const PFTP = 662;
577: public const PURENOISE = 663;
578: public const OOB_WS_HTTPS = 664;
579: public const SUN_DR = 665;
580: public const MDQS = 666;
581: public const DOOM = 666;
582: public const DISCLOSE = 667;
583: public const MECOMM = 668;
584: public const MEREGISTER = 669;
585: public const VACDSM_SWS = 670;
586: public const VACDSM_APP = 671;
587: public const VPPS_QUA = 672;
588: public const CIMPLEX = 673;
589: public const ACAP = 674;
590: public const DCTP = 675;
591: public const VPPS_VIA = 676;
592: public const VPP = 677;
593: public const GGF_NCP = 678;
594: public const MRM = 679;
595: public const ENTRUST_AAAS = 680;
596: public const ENTRUST_AAMS = 681;
597: public const XFR = 682;
598: public const CORBA_IIOP = 683;
599: public const CORBA_IIOP_SSL = 684;
600: public const MDC_PORTMAPPER = 685;
601: public const HCP_WISMAR = 686;
602: public const ASIPREGISTRY = 687;
603: public const REALM_RUSD = 688;
604: public const NMAP = 689;
605: public const VATP = 690;
606: public const MSEXCH_ROUTING = 691;
607: public const HYPERWAVE_ISP = 692;
608: public const CONNENDP = 693;
609: public const HA_CLUSTER = 694;
610: public const IEEE_MMS_SSL = 695;
611: public const RUSHD = 696;
612: public const UUIDGEN = 697;
613: public const OLSR = 698;
614: public const ACCESSNETWORK = 699;
615: public const EPP = 700;
616: public const LMP = 701;
617: public const IRIS_BEEP = 702;
618: public const ELCSD = 704;
619: public const AGENTX = 705;
620: public const SILC = 706;
621: public const BORLAND_DSJ = 707;
622: public const ENTRUST_KMSH = 709;
623: public const ENTRUST_ASH = 710;
624: public const CISCO_TDP = 711;
625: public const TBRPF = 712;
626: public const IRIS_XPC = 713;
627: public const IRIS_XPCS = 714;
628: public const IRIS_LWZ = 715;
629: public const NETVIEWDM1 = 729;
630: public const NETVIEWDM2 = 730;
631: public const NETVIEWDM3 = 731;
632: public const NETGW = 741;
633: public const NETRCS = 742;
634: public const FLEXLM = 744;
635: public const FUJITSU_DEV = 747;
636: public const RIS_CM = 748;
637: public const KERBEROS_ADM = 749;
638: public const RFILE = 750;
639: public const PUMP = 751;
640: public const QRH = 752;
641: public const RRH = 753;
642: public const TELL = 754;
643: public const NLOGIN = 758;
644: public const CON = 759;
645: public const NS = 760;
646: public const RXE = 761;
647: public const QUOTAD = 762;
648: public const CYCLESERV = 763;
649: public const OMSERV = 764;
650: public const WEBSTER = 765;
651: public const PHONEBOOK = 767;
652: public const VID = 769;
653: public const CADLOCK = 770;
654: public const RTIP = 771;
655: public const CYCLESERV2 = 772;
656: public const SUBMIT = 773;
657: public const RPASSWD = 774;
658: public const ENTOMB = 775;
659: public const WPAGES = 776;
660: public const MULTILING_HTTP = 777;
661: public const WPGS = 780;
662: public const MDBS_DAEMON = 800;
663: public const DEVICE = 801;
664: public const MBAP_S = 802;
665: public const FCP_UDP = 810;
666: public const ITM_MCELL_S = 828;
667: public const PKIX_3_CA_RA = 829;
668: public const NETCONF_SSH = 830;
669: public const NETCONF_BEEP = 831;
670: public const NETCONFSOAPHTTP = 832;
671: public const NETCONFSOAPBEEP = 833;
672: public const DHCP_FAILOVER2 = 847;
673: public const GDOI = 848;
674: public const DOMAIN_S = 853;
675: public const DLEP = 854;
676: public const ISCSI = 860;
677: public const OWAMP_CONTROL = 861;
678: public const TWAMP_CONTROL = 862;
679: public const RSYNC = 873;
680: public const ICLCNET_LOCATE = 886;
681: public const ICLCNET_SVINFO = 887;
682: public const ACCESSBUILDER = 888;
683: public const CDDBP = 888;
684: public const OMGINITIALREFS = 900;
685: public const SMPNAMERES = 901;
686: public const IDEAFARM_DOOR = 902;
687: public const IDEAFARM_PANIC = 903;
688: public const KINK = 910;
689: public const XACT_BACKUP = 911;
690: public const APEX_MESH = 912;
691: public const APEX_EDGE = 913;
692: public const RNDC = 953;
693: public const FTPS_DATA = 989;
694: public const FTPS = 990;
695: public const NAS = 991;
696: public const TELNETS = 992;
697: public const IMAPS = 993;
698: public const POP3S = 995;
699: public const VSINET = 996;
700: public const MAITRD = 997;
701: public const BUSBOY = 998;
702: public const GARCON = 999;
703: public const PUPROUTER = 999;
704: public const CADLOCK2 = 1000;
705: public const WEBPUSH = 1001;
706: public const SURF = 1010;
707: public const EXP1 = 1021;
708: public const EXP2 = 1022;
709: public const BLACKJACK = 1025;
710: public const CAP = 1026;
711: public const SOLID_MUX = 1029;
712: public const NETINFO_LOCAL = 1033;
713: public const ACTIVESYNC = 1034;
714: public const MXXRLOGIN = 1035;
715: public const NSSTP = 1036;
716: public const AMS = 1037;
717: public const MTQP = 1038;
718: public const SBL = 1039;
719: public const NETARX = 1040;
720: public const DANF_AK2 = 1041;
721: public const AFROG = 1042;
722: public const BOINC_CLIENT = 1043;
723: public const DCUTILITY = 1044;
724: public const FPITP = 1045;
725: public const WFREMOTERTM = 1046;
726: public const NEOD1 = 1047;
727: public const NEOD2 = 1048;
728: public const TD_POSTMAN = 1049;
729: public const CMA = 1050;
730: public const OPTIMA_VNET = 1051;
731: public const DDT = 1052;
732: public const REMOTE_AS = 1053;
733: public const BRVREAD = 1054;
734: public const ANSYSLMD = 1055;
735: public const VFO = 1056;
736: public const STARTRON = 1057;
737: public const NIM = 1058;
738: public const NIMREG = 1059;
739: public const POLESTAR = 1060;
740: public const KIOSK = 1061;
741: public const VERACITY = 1062;
742: public const KYOCERANETDEV = 1063;
743: public const JSTEL = 1064;
744: public const SYSCOMLAN = 1065;
745: public const FPO_FNS = 1066;
746: public const INSTL_BOOTS = 1067;
747: public const INSTL_BOOTC = 1068;
748: public const COGNEX_INSIGHT = 1069;
749: public const GMRUPDATESERV = 1070;
750: public const BSQUARE_VOIP = 1071;
751: public const CARDAX = 1072;
752: public const BRIDGECONTROL = 1073;
753: public const WARMSPOTMGMT = 1074;
754: public const RDRMSHC = 1075;
755: public const DAB_STI_C = 1076;
756: public const IMGAMES = 1077;
757: public const AVOCENT_PROXY = 1078;
758: public const ASPROVATALK = 1079;
759: public const SOCKS = 1080;
760: public const PVUNIWIEN = 1081;
761: public const AMT_ESD_PROT = 1082;
762: public const ANSOFT_LM_1 = 1083;
763: public const ANSOFT_LM_2 = 1084;
764: public const WEBOBJECTS = 1085;
765: public const CPLSCRAMBLER_LG = 1086;
766: public const CPLSCRAMBLER_IN = 1087;
767: public const CPLSCRAMBLER_AL = 1088;
768: public const FF_ANNUNC = 1089;
769: public const FF_FMS = 1090;
770: public const FF_SM = 1091;
771: public const OBRPD = 1092;
772: public const PROOFD = 1093;
773: public const ROOTD = 1094;
774: public const NICELINK = 1095;
775: public const CNRPROTOCOL = 1096;
776: public const SUNCLUSTERMGR = 1097;
777: public const RMIACTIVATION = 1098;
778: public const RMIREGISTRY = 1099;
779: public const MCTP = 1100;
780: public const PT2_DISCOVER = 1101;
781: public const ADOBESERVER_1 = 1102;
782: public const ADOBESERVER_2 = 1103;
783: public const XRL = 1104;
784: public const FTRANHC = 1105;
785: public const ISOIPSIGPORT_1 = 1106;
786: public const ISOIPSIGPORT_2 = 1107;
787: public const RATIO_ADP = 1108;
788: public const WEBADMSTART = 1110;
789: public const LMSOCIALSERVER = 1111;
790: public const ICP = 1112;
791: public const LTP_DEEPSPACE = 1113;
792: public const MINI_SQL = 1114;
793: public const ARDUS_TRNS = 1115;
794: public const ARDUS_CNTL = 1116;
795: public const ARDUS_MTRNS = 1117;
796: public const SACRED = 1118;
797: public const BNETGAME = 1119;
798: public const BNETFILE = 1120;
799: public const RMPP = 1121;
800: public const AVAILANT_MGR = 1122;
801: public const MURRAY = 1123;
802: public const HPVMMCONTROL = 1124;
803: public const HPVMMAGENT = 1125;
804: public const HPVMMDATA = 1126;
805: public const KWDB_COMMN = 1127;
806: public const SAPHOSTCTRL = 1128;
807: public const SAPHOSTCTRLS = 1129;
808: public const CASP = 1130;
809: public const CASPSSL = 1131;
810: public const KVM_VIA_IP = 1132;
811: public const DFN = 1133;
812: public const APLX = 1134;
813: public const OMNIVISION = 1135;
814: public const HHB_GATEWAY = 1136;
815: public const TRIM = 1137;
816: public const ENCRYPTED_ADMIN = 1138;
817: public const EVM = 1139;
818: public const AUTONOC = 1140;
819: public const MXOMSS = 1141;
820: public const EDTOOLS = 1142;
821: public const IMYX = 1143;
822: public const FUSCRIPT = 1144;
823: public const X9_ICUE = 1145;
824: public const AUDIT_TRANSFER = 1146;
825: public const CAPIOVERLAN = 1147;
826: public const ELFIQ_REPL = 1148;
827: public const BVTSONAR = 1149;
828: public const BLAZE = 1150;
829: public const UNIZENSUS = 1151;
830: public const WINPOPLANMESS = 1152;
831: public const C1222_ACSE = 1153;
832: public const RESACOMMUNITY = 1154;
833: public const NFA = 1155;
834: public const IASCONTROL_OMS = 1156;
835: public const IASCONTROL = 1157;
836: public const DBCONTROL_OMS = 1158;
837: public const ORACLE_OMS = 1159;
838: public const OLSV = 1160;
839: public const HEALTH_POLLING = 1161;
840: public const HEALTH_TRAP = 1162;
841: public const SDDP = 1163;
842: public const QSM_PROXY = 1164;
843: public const QSM_GUI = 1165;
844: public const QSM_REMOTE = 1166;
845: public const CISCO_IPSLA = 1167;
846: public const VCHAT = 1168;
847: public const TRIPWIRE = 1169;
848: public const ATC_LM = 1170;
849: public const ATC_APPSERVER = 1171;
850: public const DNAP = 1172;
851: public const D_CINEMA_RRP = 1173;
852: public const FNET_REMOTE_UI = 1174;
853: public const DOSSIER = 1175;
854: public const INDIGO_SERVER = 1176;
855: public const DKMESSENGER = 1177;
856: public const SGI_STORMAN = 1178;
857: public const B2N = 1179;
858: public const MC_CLIENT = 1180;
859: public const _3COMNETMAN = 1181;
860: public const ACCELENET = 1182;
861: public const LLSURFUP_HTTP = 1183;
862: public const LLSURFUP_HTTPS = 1184;
863: public const CATCHPOLE = 1185;
864: public const MYSQL_CLUSTER = 1186;
865: public const ALIAS = 1187;
866: public const HP_WEBADMIN = 1188;
867: public const UNET = 1189;
868: public const COMMLINX_AVL = 1190;
869: public const GPFS = 1191;
870: public const CAIDS_SENSOR = 1192;
871: public const FIVEACROSS = 1193;
872: public const OPENVPN = 1194;
873: public const RSF_1 = 1195;
874: public const NETMAGIC = 1196;
875: public const CARRIUS_RSHELL = 1197;
876: public const CAJO_DISCOVERY = 1198;
877: public const DMIDI = 1199;
878: public const SCOL = 1200;
879: public const NUCLEUS_SAND = 1201;
880: public const CAICCIPC = 1202;
881: public const SSSLIC_MGR = 1203;
882: public const SSSLOG_MGR = 1204;
883: public const ACCORD_MGC = 1205;
884: public const ANTHONY_DATA = 1206;
885: public const METASAGE = 1207;
886: public const SEAGULL_AIS = 1208;
887: public const IPCD3 = 1209;
888: public const EOSS = 1210;
889: public const GROOVE_DPP = 1211;
890: public const LUPA = 1212;
891: public const MPC_LIFENET = 1213;
892: public const KAZAA = 1214;
893: public const SCANSTAT_1 = 1215;
894: public const ETEBAC5 = 1216;
895: public const HPSS_NDAPI = 1217;
896: public const AEROFLIGHT_ADS = 1218;
897: public const AEROFLIGHT_RET = 1219;
898: public const QT_SERVERADMIN = 1220;
899: public const SWEETWARE_APPS = 1221;
900: public const NERV = 1222;
901: public const TGP = 1223;
902: public const VPNZ = 1224;
903: public const SLINKYSEARCH = 1225;
904: public const STGXFWS = 1226;
905: public const DNS2GO = 1227;
906: public const FLORENCE = 1228;
907: public const ZENTED = 1229;
908: public const PERISCOPE = 1230;
909: public const MENANDMICE_LPM = 1231;
910: public const FIRST_DEFENSE = 1232;
911: public const UNIV_APPSERVER = 1233;
912: public const SEARCH_AGENT = 1234;
913: public const MOSAICSYSSVC1 = 1235;
914: public const BVCONTROL = 1236;
915: public const TSDOS390 = 1237;
916: public const HACL_QS = 1238;
917: public const NMSD = 1239;
918: public const INSTANTIA = 1240;
919: public const NESSUS = 1241;
920: public const NMASOVERIP = 1242;
921: public const SERIALGATEWAY = 1243;
922: public const ISBCONFERENCE1 = 1244;
923: public const ISBCONFERENCE2 = 1245;
924: public const PAYROUTER = 1246;
925: public const VISIONPYRAMID = 1247;
926: public const HERMES = 1248;
927: public const MESAVISTACO = 1249;
928: public const SWLDY_SIAS = 1250;
929: public const SERVERGRAPH = 1251;
930: public const BSPNE_PCC = 1252;
931: public const Q55_PCC = 1253;
932: public const DE_NOC = 1254;
933: public const DE_CACHE_QUERY = 1255;
934: public const DE_SERVER = 1256;
935: public const SHOCKWAVE2 = 1257;
936: public const OPENNL = 1258;
937: public const OPENNL_VOICE = 1259;
938: public const IBM_SSD = 1260;
939: public const MPSHRSV = 1261;
940: public const QNTS_ORB = 1262;
941: public const DKA = 1263;
942: public const PRAT = 1264;
943: public const DSSIAPI = 1265;
944: public const DELLPWRAPPKS = 1266;
945: public const EPC = 1267;
946: public const PROPEL_MSGSYS = 1268;
947: public const WATILAPP = 1269;
948: public const OPSMGR = 1270;
949: public const EXCW = 1271;
950: public const CSPMLOCKMGR = 1272;
951: public const EMC_GATEWAY = 1273;
952: public const T1DISTPROC = 1274;
953: public const IVCOLLECTOR = 1275;
954: public const MIVA_MQS = 1277;
955: public const DELLWEBADMIN_1 = 1278;
956: public const DELLWEBADMIN_2 = 1279;
957: public const PICTROGRAPHY = 1280;
958: public const HEALTHD = 1281;
959: public const EMPERION = 1282;
960: public const PRODUCTINFO = 1283;
961: public const IEE_QFX = 1284;
962: public const NEOIFACE = 1285;
963: public const NETUITIVE = 1286;
964: public const ROUTEMATCH = 1287;
965: public const NAVBUDDY = 1288;
966: public const JWALKSERVER = 1289;
967: public const WINJASERVER = 1290;
968: public const SEAGULLLMS = 1291;
969: public const DSDN = 1292;
970: public const PKT_KRB_IPSEC = 1293;
971: public const CMMDRIVER = 1294;
972: public const EHTP = 1295;
973: public const DPROXY = 1296;
974: public const SDPROXY = 1297;
975: public const LPCP = 1298;
976: public const HP_SCI = 1299;
977: public const H323HOSTCALLSC = 1300;
978: public const CI3_SOFTWARE_1 = 1301;
979: public const CI3_SOFTWARE_2 = 1302;
980: public const SFTSRV = 1303;
981: public const BOOMERANG = 1304;
982: public const PE_MIKE = 1305;
983: public const RE_CONN_PROTO = 1306;
984: public const PACMAND = 1307;
985: public const ODSI = 1308;
986: public const JTAG_SERVER = 1309;
987: public const HUSKY = 1310;
988: public const RXMON = 1311;
989: public const STI_ENVISION = 1312;
990: public const BMC_PATROLDB = 1313;
991: public const PDPS = 1314;
992: public const ELS = 1315;
993: public const EXBIT_ESCP = 1316;
994: public const VRTS_IPCSERVER = 1317;
995: public const KRB5GATEKEEPER = 1318;
996: public const AMX_ICSP = 1319;
997: public const AMX_AXBNET = 1320;
998: public const PIP_2 = 1321;
999: public const NOVATION = 1322;
1000: public const BRCD = 1323;
1001: public const DELTA_MCP = 1324;
1002: public const DX_INSTRUMENT = 1325;
1003: public const WIMSIC = 1326;
1004: public const ULTREX = 1327;
1005: public const EWALL = 1328;
1006: public const NETDB_EXPORT = 1329;
1007: public const STREETPERFECT = 1330;
1008: public const INTERSAN = 1331;
1009: public const PCIA_RXP_B = 1332;
1010: public const PASSWRD_POLICY = 1333;
1011: public const WRITESRV = 1334;
1012: public const DIGITAL_NOTARY = 1335;
1013: public const ISCHAT = 1336;
1014: public const MENANDMICE_DNS = 1337;
1015: public const WMC_LOG_SVC = 1338;
1016: public const KJTSITESERVER = 1339;
1017: public const NAAP = 1340;
1018: public const QUBES = 1341;
1019: public const ESBROKER = 1342;
1020: public const RE101 = 1343;
1021: public const ICAP = 1344;
1022: public const VPJP = 1345;
1023: public const ALTA_ANA_LM = 1346;
1024: public const BBN_MMC = 1347;
1025: public const BBN_MMX = 1348;
1026: public const SBOOK = 1349;
1027: public const EDITBENCH = 1350;
1028: public const EQUATIONBUILDER = 1351;
1029: public const LOTUSNOTE = 1352;
1030: public const RELIEF = 1353;
1031: public const XSIP_NETWORK = 1354;
1032: public const INTUITIVE_EDGE = 1355;
1033: public const CUILLAMARTIN = 1356;
1034: public const PEGBOARD = 1357;
1035: public const CONNLCLI = 1358;
1036: public const FTSRV = 1359;
1037: public const MIMER = 1360;
1038: public const LINX = 1361;
1039: public const TIMEFLIES = 1362;
1040: public const NDM_REQUESTER = 1363;
1041: public const NDM_SERVER = 1364;
1042: public const ADAPT_SNA = 1365;
1043: public const NETWARE_CSP = 1366;
1044: public const DCS = 1367;
1045: public const SCREENCAST = 1368;
1046: public const GV_US = 1369;
1047: public const US_GV = 1370;
1048: public const FC_CLI = 1371;
1049: public const FC_SER = 1372;
1050: public const CHROMAGRAFX = 1373;
1051: public const MOLLY = 1374;
1052: public const BYTEX = 1375;
1053: public const IBM_PPS = 1376;
1054: public const CICHLID = 1377;
1055: public const ELAN = 1378;
1056: public const DBREPORTER = 1379;
1057: public const TELESIS_LICMAN = 1380;
1058: public const APPLE_LICMAN = 1381;
1059: public const UDT_OS = 1382;
1060: public const GWHA = 1383;
1061: public const OS_LICMAN = 1384;
1062: public const ATEX_ELMD = 1385;
1063: public const CHECKSUM = 1386;
1064: public const CADSI_LM = 1387;
1065: public const OBJECTIVE_DBC = 1388;
1066: public const ICLPV_DM = 1389;
1067: public const ICLPV_SC = 1390;
1068: public const ICLPV_SAS = 1391;
1069: public const ICLPV_PM = 1392;
1070: public const ICLPV_NLS = 1393;
1071: public const ICLPV_NLC = 1394;
1072: public const ICLPV_WSM = 1395;
1073: public const DVL_ACTIVEMAIL = 1396;
1074: public const AUDIO_ACTIVMAIL = 1397;
1075: public const VIDEO_ACTIVMAIL = 1398;
1076: public const CADKEY_LICMAN = 1399;
1077: public const CADKEY_TABLET = 1400;
1078: public const GOLDLEAF_LICMAN = 1401;
1079: public const PRM_SM_NP = 1402;
1080: public const PRM_NM_NP = 1403;
1081: public const IGI_LM = 1404;
1082: public const IBM_RES = 1405;
1083: public const NETLABS_LM = 1406;
1084: public const TIBET_SERVER = 1407;
1085: public const SOPHIA_LM = 1408;
1086: public const HERE_LM = 1409;
1087: public const HIQ = 1410;
1088: public const AF = 1411;
1089: public const INNOSYS = 1412;
1090: public const INNOSYS_ACL = 1413;
1091: public const IBM_MQSERIES = 1414;
1092: public const DBSTAR = 1415;
1093: public const NOVELL_LU6_2 = 1416;
1094: public const TIMBUKTU_SRV1 = 1417;
1095: public const TIMBUKTU_SRV2 = 1418;
1096: public const TIMBUKTU_SRV3 = 1419;
1097: public const TIMBUKTU_SRV4 = 1420;
1098: public const GANDALF_LM = 1421;
1099: public const AUTODESK_LM = 1422;
1100: public const ESSBASE = 1423;
1101: public const HYBRID = 1424;
1102: public const ZION_LM = 1425;
1103: public const SAIS = 1426;
1104: public const MLOADD = 1427;
1105: public const INFORMATIK_LM = 1428;
1106: public const NMS = 1429;
1107: public const TPDU = 1430;
1108: public const RGTP = 1431;
1109: public const BLUEBERRY_LM = 1432;
1110: public const MS_SQL_S = 1433;
1111: public const MS_SQL_M = 1434;
1112: public const IBM_CICS = 1435;
1113: public const SAISM = 1436;
1114: public const TABULA = 1437;
1115: public const EICON_SERVER = 1438;
1116: public const EICON_X25 = 1439;
1117: public const EICON_SLP = 1440;
1118: public const CADIS_1 = 1441;
1119: public const CADIS_2 = 1442;
1120: public const IES_LM = 1443;
1121: public const MARCAM_LM = 1444;
1122: public const PROXIMA_LM = 1445;
1123: public const ORA_LM = 1446;
1124: public const APRI_LM = 1447;
1125: public const OC_LM = 1448;
1126: public const PEPORT = 1449;
1127: public const DWF = 1450;
1128: public const INFOMAN = 1451;
1129: public const GTEGSC_LM = 1452;
1130: public const GENIE_LM = 1453;
1131: public const INTERHDL_ELMD = 1454;
1132: public const ESL_LM = 1455;
1133: public const DCA = 1456;
1134: public const VALISYS_LM = 1457;
1135: public const NRCABQ_LM = 1458;
1136: public const PROSHARE1 = 1459;
1137: public const PROSHARE2 = 1460;
1138: public const IBM_WRLESS_LAN = 1461;
1139: public const WORLD_LM = 1462;
1140: public const NUCLEUS = 1463;
1141: public const MSL_LMD = 1464;
1142: public const PIPES = 1465;
1143: public const OCEANSOFT_LM = 1466;
1144: public const CSDMBASE = 1467;
1145: public const CSDM = 1468;
1146: public const AAL_LM = 1469;
1147: public const UAIACT = 1470;
1148: public const CSDMBASE_2 = 1471;
1149: public const CSDM_2 = 1472;
1150: public const OPENMATH = 1473;
1151: public const TELEFINDER = 1474;
1152: public const TALIGENT_LM = 1475;
1153: public const CLVM_CFG = 1476;
1154: public const MS_SNA_SERVER = 1477;
1155: public const MS_SNA_BASE = 1478;
1156: public const DBEREGISTER = 1479;
1157: public const PACERFORUM = 1480;
1158: public const AIRS = 1481;
1159: public const MITEKSYS_LM = 1482;
1160: public const AFS = 1483;
1161: public const CONFLUENT = 1484;
1162: public const LANSOURCE = 1485;
1163: public const NMS_TOPO_SERV = 1486;
1164: public const LOCALINFOSRVR = 1487;
1165: public const DOCSTOR = 1488;
1166: public const DMDOCBROKER = 1489;
1167: public const INSITU_CONF = 1490;
1168: public const STONE_DESIGN_1 = 1492;
1169: public const NETMAP_LM = 1493;
1170: public const ICA = 1494;
1171: public const CVC = 1495;
1172: public const LIBERTY_LM = 1496;
1173: public const RFX_LM = 1497;
1174: public const SYBASE_SQLANY = 1498;
1175: public const FHC = 1499;
1176: public const VLSI_LM = 1500;
1177: public const SAISCM = 1501;
1178: public const SHIVADISCOVERY = 1502;
1179: public const IMTC_MCS = 1503;
1180: public const EVB_ELM = 1504;
1181: public const FUNKPROXY = 1505;
1182: public const UTCD = 1506;
1183: public const SYMPLEX = 1507;
1184: public const DIAGMOND = 1508;
1185: public const ROBCAD_LM = 1509;
1186: public const MVX_LM = 1510;
1187: public const _3L_L1 = 1511;
1188: public const WINS = 1512;
1189: public const FUJITSU_DTC = 1513;
1190: public const FUJITSU_DTCNS = 1514;
1191: public const IFOR_PROTOCOL = 1515;
1192: public const VPAD = 1516;
1193: public const VPAC = 1517;
1194: public const VPVD = 1518;
1195: public const VPVC = 1519;
1196: public const ATM_ZIP_OFFICE = 1520;
1197: public const NCUBE_LM = 1521;
1198: public const RICARDO_LM = 1522;
1199: public const CICHILD_LM = 1523;
1200: public const INGRESLOCK = 1524;
1201: public const ORASRV = 1525;
1202: public const PROSPERO_NP = 1525;
1203: public const PDAP_NP = 1526;
1204: public const TLISRV = 1527;
1205: public const COAUTHOR = 1529;
1206: public const RAP_SERVICE = 1530;
1207: public const RAP_LISTEN = 1531;
1208: public const MIROCONNECT = 1532;
1209: public const VIRTUAL_PLACES = 1533;
1210: public const MICROMUSE_LM = 1534;
1211: public const AMPR_INFO = 1535;
1212: public const AMPR_INTER = 1536;
1213: public const SDSC_LM = 1537;
1214: public const _3DS_LM = 1538;
1215: public const INTELLISTOR_LM = 1539;
1216: public const RDS = 1540;
1217: public const RDS2 = 1541;
1218: public const GRIDGEN_ELMD = 1542;
1219: public const SIMBA_CS = 1543;
1220: public const ASPECLMD = 1544;
1221: public const VISTIUM_SHARE = 1545;
1222: public const ABBACCURAY = 1546;
1223: public const LAPLINK = 1547;
1224: public const AXON_LM = 1548;
1225: public const SHIVAHOSE = 1549;
1226: public const _3M_IMAGE_LM = 1550;
1227: public const HECMTL_DB = 1551;
1228: public const PCIARRAY = 1552;
1229: public const SNA_CS = 1553;
1230: public const CACI_LM = 1554;
1231: public const LIVELAN = 1555;
1232: public const VERITAS_PBX = 1556;
1233: public const ARBORTEXT_LM = 1557;
1234: public const XINGMPEG = 1558;
1235: public const WEB2HOST = 1559;
1236: public const ASCI_VAL = 1560;
1237: public const FACILITYVIEW = 1561;
1238: public const PCONNECTMGR = 1562;
1239: public const CADABRA_LM = 1563;
1240: public const PAY_PER_VIEW = 1564;
1241: public const WINDDLB = 1565;
1242: public const CORELVIDEO = 1566;
1243: public const JLICELMD = 1567;
1244: public const TSSPMAP = 1568;
1245: public const ETS = 1569;
1246: public const ORBIXD = 1570;
1247: public const RDB_DBS_DISP = 1571;
1248: public const CHIP_LM = 1572;
1249: public const ITSCOMM_NS = 1573;
1250: public const MVEL_LM = 1574;
1251: public const ORACLENAMES = 1575;
1252: public const MOLDFLOW_LM = 1576;
1253: public const HYPERCUBE_LM = 1577;
1254: public const JACOBUS_LM = 1578;
1255: public const IOC_SEA_LM = 1579;
1256: public const TN_TL_R1 = 1580;
1257: public const MIL_2045_47001 = 1581;
1258: public const MSIMS = 1582;
1259: public const SIMBAEXPRESS = 1583;
1260: public const TN_TL_FD2 = 1584;
1261: public const INTV = 1585;
1262: public const IBM_ABTACT = 1586;
1263: public const PRA_ELMD = 1587;
1264: public const TRIQUEST_LM = 1588;
1265: public const VQP = 1589;
1266: public const GEMINI_LM = 1590;
1267: public const NCPM_PM = 1591;
1268: public const COMMONSPACE = 1592;
1269: public const MAINSOFT_LM = 1593;
1270: public const SIXTRAK = 1594;
1271: public const RADIO = 1595;
1272: public const RADIO_SM = 1596;
1273: public const ORBPLUS_IIOP = 1597;
1274: public const PICKNFS = 1598;
1275: public const SIMBASERVICES = 1599;
1276: public const ISSD = 1600;
1277: public const AAS = 1601;
1278: public const INSPECT = 1602;
1279: public const PICODBC = 1603;
1280: public const ICABROWSER = 1604;
1281: public const SLP = 1605;
1282: public const SLM_API = 1606;
1283: public const STT = 1607;
1284: public const SMART_LM = 1608;
1285: public const ISYSG_LM = 1609;
1286: public const TAURUS_WH = 1610;
1287: public const ILL = 1611;
1288: public const NETBILL_TRANS = 1612;
1289: public const NETBILL_KEYREP = 1613;
1290: public const NETBILL_CRED = 1614;
1291: public const NETBILL_AUTH = 1615;
1292: public const NETBILL_PROD = 1616;
1293: public const NIMROD_AGENT = 1617;
1294: public const SKYTELNET = 1618;
1295: public const XS_OPENSTORAGE = 1619;
1296: public const FAXPORTWINPORT = 1620;
1297: public const SOFTDATAPHONE = 1621;
1298: public const ONTIME = 1622;
1299: public const JALEOSND = 1623;
1300: public const UDP_SR_PORT = 1624;
1301: public const SVS_OMAGENT = 1625;
1302: public const SHOCKWAVE = 1626;
1303: public const T128_GATEWAY = 1627;
1304: public const LONTALK_NORM = 1628;
1305: public const LONTALK_URGNT = 1629;
1306: public const ORACLENET8CMAN = 1630;
1307: public const VISITVIEW = 1631;
1308: public const PAMMRATC = 1632;
1309: public const PAMMRPC = 1633;
1310: public const LOAPROBE = 1634;
1311: public const EDB_SERVER1 = 1635;
1312: public const ISDC = 1636;
1313: public const ISLC = 1637;
1314: public const ISMC = 1638;
1315: public const CERT_INITIATOR = 1639;
1316: public const CERT_RESPONDER = 1640;
1317: public const INVISION = 1641;
1318: public const ISIS_AM = 1642;
1319: public const ISIS_AMBC = 1643;
1320: public const SAISEH = 1644;
1321: public const SIGHTLINE = 1645;
1322: public const SA_MSG_PORT = 1646;
1323: public const RSAP = 1647;
1324: public const CONCURRENT_LM = 1648;
1325: public const KERMIT = 1649;
1326: public const NKD = 1650;
1327: public const SHIVA_CONFSRVR = 1651;
1328: public const XNMP = 1652;
1329: public const ALPHATECH_LM = 1653;
1330: public const STARGATEALERTS = 1654;
1331: public const DEC_MBADMIN = 1655;
1332: public const DEC_MBADMIN_H = 1656;
1333: public const FUJITSU_MMPDC = 1657;
1334: public const SIXNETUDR = 1658;
1335: public const SG_LM = 1659;
1336: public const SKIP_MC_GIKREQ = 1660;
1337: public const NETVIEW_AIX_1 = 1661;
1338: public const NETVIEW_AIX_2 = 1662;
1339: public const NETVIEW_AIX_3 = 1663;
1340: public const NETVIEW_AIX_4 = 1664;
1341: public const NETVIEW_AIX_5 = 1665;
1342: public const NETVIEW_AIX_6 = 1666;
1343: public const NETVIEW_AIX_7 = 1667;
1344: public const NETVIEW_AIX_8 = 1668;
1345: public const NETVIEW_AIX_9 = 1669;
1346: public const NETVIEW_AIX_10 = 1670;
1347: public const NETVIEW_AIX_11 = 1671;
1348: public const NETVIEW_AIX_12 = 1672;
1349: public const PROSHARE_MC_1 = 1673;
1350: public const PROSHARE_MC_2 = 1674;
1351: public const PDP = 1675;
1352: public const NETCOMM1 = 1676;
1353: public const GROUPWISE = 1677;
1354: public const PROLINK = 1678;
1355: public const DARCORP_LM = 1679;
1356: public const MICROCOM_SBP = 1680;
1357: public const SD_ELMD = 1681;
1358: public const LANYON_LANTERN = 1682;
1359: public const NCPM_HIP = 1683;
1360: public const SNARESECURE = 1684;
1361: public const N2NREMOTE = 1685;
1362: public const CVMON = 1686;
1363: public const NSJTP_CTRL = 1687;
1364: public const NSJTP_DATA = 1688;
1365: public const FIREFOX = 1689;
1366: public const NG_UMDS = 1690;
1367: public const EMPIRE_EMPUMA = 1691;
1368: public const SSTSYS_LM = 1692;
1369: public const RRIRTR = 1693;
1370: public const RRIMWM = 1694;
1371: public const RRILWM = 1695;
1372: public const RRIFMM = 1696;
1373: public const RRISAT = 1697;
1374: public const RSVP_ENCAP_1 = 1698;
1375: public const RSVP_ENCAP_2 = 1699;
1376: public const MPS_RAFT = 1700;
1377: public const L2F = 1701;
1378: public const L2TP = 1701;
1379: public const DESKSHARE = 1702;
1380: public const HB_ENGINE = 1703;
1381: public const BCS_BROKER = 1704;
1382: public const SLINGSHOT = 1705;
1383: public const JETFORM = 1706;
1384: public const VDMPLAY = 1707;
1385: public const GAT_LMD = 1708;
1386: public const CENTRA = 1709;
1387: public const IMPERA = 1710;
1388: public const PPTCONFERENCE = 1711;
1389: public const REGISTRAR = 1712;
1390: public const CONFERENCETALK = 1713;
1391: public const SESI_LM = 1714;
1392: public const HOUDINI_LM = 1715;
1393: public const XMSG = 1716;
1394: public const FJ_HDNET = 1717;
1395: public const H323GATEDISC = 1718;
1396: public const H323GATESTAT = 1719;
1397: public const H323HOSTCALL = 1720;
1398: public const CAICCI = 1721;
1399: public const HKS_LM = 1722;
1400: public const PPTP = 1723;
1401: public const CSBPHONEMASTER = 1724;
1402: public const IDEN_RALP = 1725;
1403: public const IBERIAGAMES = 1726;
1404: public const WINDDX = 1727;
1405: public const TELINDUS = 1728;
1406: public const CITYNL = 1729;
1407: public const ROKETZ = 1730;
1408: public const MSICCP = 1731;
1409: public const PROXIM = 1732;
1410: public const SIIPAT = 1733;
1411: public const CAMBERTX_LM = 1734;
1412: public const PRIVATECHAT = 1735;
1413: public const STREET_STREAM = 1736;
1414: public const ULTIMAD = 1737;
1415: public const GAMEGEN1 = 1738;
1416: public const WEBACCESS = 1739;
1417: public const ENCORE = 1740;
1418: public const CISCO_NET_MGMT = 1741;
1419: public const _3COM_NSD = 1742;
1420: public const CINEGRFX_LM = 1743;
1421: public const NCPM_FT = 1744;
1422: public const REMOTE_WINSOCK = 1745;
1423: public const FTRAPID_1 = 1746;
1424: public const FTRAPID_2 = 1747;
1425: public const ORACLE_EM1 = 1748;
1426: public const ASPEN_SERVICES = 1749;
1427: public const SSLP = 1750;
1428: public const SWIFTNET = 1751;
1429: public const LOFR_LM = 1752;
1430: public const PREDATAR_COMMS = 1753;
1431: public const ORACLE_EM2 = 1754;
1432: public const MS_STREAMING = 1755;
1433: public const CAPFAST_LMD = 1756;
1434: public const CNHRP = 1757;
1435: public const TFTP_MCAST = 1758;
1436: public const SPSS_LM = 1759;
1437: public const WWW_LDAP_GW = 1760;
1438: public const CFT_0 = 1761;
1439: public const CFT_1 = 1762;
1440: public const CFT_2 = 1763;
1441: public const CFT_3 = 1764;
1442: public const CFT_4 = 1765;
1443: public const CFT_5 = 1766;
1444: public const CFT_6 = 1767;
1445: public const CFT_7 = 1768;
1446: public const BMC_NET_ADM = 1769;
1447: public const BMC_NET_SVC = 1770;
1448: public const VAULTBASE = 1771;
1449: public const ESSWEB_GW = 1772;
1450: public const KMSCONTROL = 1773;
1451: public const GLOBAL_DTSERV = 1774;
1452: public const VDAB = 1775;
1453: public const FEMIS = 1776;
1454: public const POWERGUARDIAN = 1777;
1455: public const PRODIGY_INTRNET = 1778;
1456: public const PHARMASOFT = 1779;
1457: public const DPKEYSERV = 1780;
1458: public const ANSWERSOFT_LM = 1781;
1459: public const HP_HCIP = 1782;
1460: public const FINLE_LM = 1784;
1461: public const WINDLM = 1785;
1462: public const FUNK_LOGGER = 1786;
1463: public const FUNK_LICENSE = 1787;
1464: public const PSMOND = 1788;
1465: public const HELLO = 1789;
1466: public const NMSP_2 = 1790;
1467: public const EA1 = 1791;
1468: public const IBM_DT_2 = 1792;
1469: public const RSC_ROBOT = 1793;
1470: public const CERA_BCM = 1794;
1471: public const DPI_PROXY = 1795;
1472: public const VOCALTEC_ADMIN = 1796;
1473: public const UMA_2 = 1797;
1474: public const ETP = 1798;
1475: public const NETRISK = 1799;
1476: public const ANSYS_LM = 1800;
1477: public const MSMQ = 1801;
1478: public const CONCOMP1 = 1802;
1479: public const HP_HCIP_GWY = 1803;
1480: public const ENL = 1804;
1481: public const ENL_NAME = 1805;
1482: public const MUSICONLINE = 1806;
1483: public const FHSP = 1807;
1484: public const ORACLE_VP2 = 1808;
1485: public const ORACLE_VP1 = 1809;
1486: public const JERAND_LM = 1810;
1487: public const SCIENTIA_SDB = 1811;
1488: public const RADIUS = 1812;
1489: public const RADIUS_ACCT = 1813;
1490: public const TDP_SUITE = 1814;
1491: public const MMPFT = 1815;
1492: public const HARP = 1816;
1493: public const RKB_OSCS = 1817;
1494: public const ETFTP = 1818;
1495: public const PLATO_LM = 1819;
1496: public const MCAGENT = 1820;
1497: public const DONNYWORLD = 1821;
1498: public const ES_ELMD = 1822;
1499: public const UNISYS_LM = 1823;
1500: public const METRICS_PAS = 1824;
1501: public const DIRECPC_VIDEO = 1825;
1502: public const ARDT = 1826;
1503: public const ASI = 1827;
1504: public const ITM_MCELL_U = 1828;
1505: public const OPTIKA_EMEDIA = 1829;
1506: public const NET8_CMAN = 1830;
1507: public const MYRTLE = 1831;
1508: public const THT_TREASURE = 1832;
1509: public const UDPRADIO = 1833;
1510: public const ARDUSUNI = 1834;
1511: public const ARDUSMUL = 1835;
1512: public const STE_SMSC = 1836;
1513: public const CSOFT1 = 1837;
1514: public const TALNET = 1838;
1515: public const NETOPIA_VO1 = 1839;
1516: public const NETOPIA_VO2 = 1840;
1517: public const NETOPIA_VO3 = 1841;
1518: public const NETOPIA_VO4 = 1842;
1519: public const NETOPIA_VO5 = 1843;
1520: public const DIRECPC_DLL = 1844;
1521: public const ALTALINK = 1845;
1522: public const TUNSTALL_PNC = 1846;
1523: public const SLP_NOTIFY = 1847;
1524: public const FJDOCDIST = 1848;
1525: public const ALPHA_SMS = 1849;
1526: public const GSI = 1850;
1527: public const CTCD = 1851;
1528: public const VIRTUAL_TIME = 1852;
1529: public const VIDS_AVTP = 1853;
1530: public const BUDDY_DRAW = 1854;
1531: public const FIORANO_RTRSVC = 1855;
1532: public const FIORANO_MSGSVC = 1856;
1533: public const DATACAPTOR = 1857;
1534: public const PRIVATEARK = 1858;
1535: public const GAMMAFETCHSVR = 1859;
1536: public const SUNSCALAR_SVC = 1860;
1537: public const LECROY_VICP = 1861;
1538: public const MYSQL_CM_AGENT = 1862;
1539: public const MSNP = 1863;
1540: public const PARADYM_31PORT = 1864;
1541: public const ENTP = 1865;
1542: public const SWRMI = 1866;
1543: public const UDRIVE = 1867;
1544: public const VIZIBLEBROWSER = 1868;
1545: public const TRANSACT = 1869;
1546: public const SUNSCALAR_DNS = 1870;
1547: public const CANOCENTRAL0 = 1871;
1548: public const CANOCENTRAL1 = 1872;
1549: public const FJMPJPS = 1873;
1550: public const FJSWAPSNP = 1874;
1551: public const WESTELL_STATS = 1875;
1552: public const EWCAPPSRV = 1876;
1553: public const HP_WEBQOSDB = 1877;
1554: public const DRMSMC = 1878;
1555: public const NETTGAIN_NMS = 1879;
1556: public const VSAT_CONTROL = 1880;
1557: public const IBM_MQSERIES2 = 1881;
1558: public const ECSQDMN = 1882;
1559: public const MQTT = 1883;
1560: public const IDMAPS = 1884;
1561: public const VRTSTRAPSERVER = 1885;
1562: public const LEOIP = 1886;
1563: public const FILEX_LPORT = 1887;
1564: public const NCCONFIG = 1888;
1565: public const UNIFY_ADAPTER = 1889;
1566: public const WILKENLISTENER = 1890;
1567: public const CHILDKEY_NOTIF = 1891;
1568: public const CHILDKEY_CTRL = 1892;
1569: public const ELAD = 1893;
1570: public const O2SERVER_PORT = 1894;
1571: public const B_NOVATIVE_LS = 1896;
1572: public const METAAGENT = 1897;
1573: public const CYMTEC_PORT = 1898;
1574: public const MC2STUDIOS = 1899;
1575: public const SSDP = 1900;
1576: public const FJICL_TEP_A = 1901;
1577: public const FJICL_TEP_B = 1902;
1578: public const LINKNAME = 1903;
1579: public const FJICL_TEP_C = 1904;
1580: public const SUGP = 1905;
1581: public const TPMD = 1906;
1582: public const INTRASTAR = 1907;
1583: public const DAWN = 1908;
1584: public const GLOBAL_WLINK = 1909;
1585: public const ULTRABAC = 1910;
1586: public const MTP = 1911;
1587: public const RHP_IIBP = 1912;
1588: public const ARMADP = 1913;
1589: public const ELM_MOMENTUM = 1914;
1590: public const FACELINK = 1915;
1591: public const PERSONA = 1916;
1592: public const NOAGENT = 1917;
1593: public const CAN_NDS = 1918;
1594: public const CAN_DCH = 1919;
1595: public const CAN_FERRET = 1920;
1596: public const NOADMIN = 1921;
1597: public const TAPESTRY = 1922;
1598: public const SPICE = 1923;
1599: public const XIIP = 1924;
1600: public const DISCOVERY_PORT = 1925;
1601: public const EGS = 1926;
1602: public const VIDETE_CIPC = 1927;
1603: public const EMSD_PORT = 1928;
1604: public const BANDWIZ_SYSTEM = 1929;
1605: public const DRIVEAPPSERVER = 1930;
1606: public const AMDSCHED = 1931;
1607: public const CTT_BROKER = 1932;
1608: public const XMAPI = 1933;
1609: public const XAAPI = 1934;
1610: public const MACROMEDIA_FCS = 1935;
1611: public const JETCMESERVER = 1936;
1612: public const JWSERVER = 1937;
1613: public const JWCLIENT = 1938;
1614: public const JVSERVER = 1939;
1615: public const JVCLIENT = 1940;
1616: public const DIC_AIDA = 1941;
1617: public const RES = 1942;
1618: public const BEEYOND_MEDIA = 1943;
1619: public const CLOSE_COMBAT = 1944;
1620: public const DIALOGIC_ELMD = 1945;
1621: public const TEKPLS = 1946;
1622: public const SENTINELSRM = 1947;
1623: public const EYE2EYE = 1948;
1624: public const ISMAEASDAQLIVE = 1949;
1625: public const ISMAEASDAQTEST = 1950;
1626: public const BCS_LMSERVER = 1951;
1627: public const MPNJSC = 1952;
1628: public const RAPIDBASE = 1953;
1629: public const ABR_API = 1954;
1630: public const ABR_SECURE = 1955;
1631: public const VRTL_VMF_DS = 1956;
1632: public const UNIX_STATUS = 1957;
1633: public const DXADMIND = 1958;
1634: public const SIMP_ALL = 1959;
1635: public const NASMANAGER = 1960;
1636: public const BTS_APPSERVER = 1961;
1637: public const BIAP_MP = 1962;
1638: public const WEBMACHINE = 1963;
1639: public const SOLID_E_ENGINE = 1964;
1640: public const TIVOLI_NPM = 1965;
1641: public const SLUSH = 1966;
1642: public const SNS_QUOTE = 1967;
1643: public const LIPSINC = 1968;
1644: public const LIPSINC1 = 1969;
1645: public const NETOP_RC = 1970;
1646: public const NETOP_SCHOOL = 1971;
1647: public const INTERSYS_CACHE = 1972;
1648: public const DLSRAP = 1973;
1649: public const DRP = 1974;
1650: public const TCOFLASHAGENT = 1975;
1651: public const TCOREGAGENT = 1976;
1652: public const TCOADDRESSBOOK = 1977;
1653: public const UNISQL = 1978;
1654: public const UNISQL_JAVA = 1979;
1655: public const PEARLDOC_XACT = 1980;
1656: public const P2PQ = 1981;
1657: public const ESTAMP = 1982;
1658: public const LHTP = 1983;
1659: public const BB = 1984;
1660: public const HSRP = 1985;
1661: public const LICENSEDAEMON = 1986;
1662: public const TR_RSRB_P1 = 1987;
1663: public const TR_RSRB_P2 = 1988;
1664: public const TR_RSRB_P3 = 1989;
1665: public const MSHNET = 1989;
1666: public const STUN_P1 = 1990;
1667: public const STUN_P2 = 1991;
1668: public const STUN_P3 = 1992;
1669: public const IPSENDMSG = 1992;
1670: public const SNMP_TCP_PORT = 1993;
1671: public const STUN_PORT = 1994;
1672: public const PERF_PORT = 1995;
1673: public const TR_RSRB_PORT = 1996;
1674: public const GDP_PORT = 1997;
1675: public const X25_SVC_PORT = 1998;
1676: public const TCP_ID_PORT = 1999;
1677: public const CISCO_SCCP = 2000;
1678: public const DC = 2001;
1679: public const GLOBE = 2002;
1680: public const BRUTUS = 2003;
1681: public const MAILBOX = 2004;
1682: public const BERKNET = 2005;
1683: public const INVOKATOR = 2006;
1684: public const DECTALK = 2007;
1685: public const CONF = 2008;
1686: public const NEWS = 2009;
1687: public const SEARCH = 2010;
1688: public const RAID_CC = 2011;
1689: public const TTYINFO = 2012;
1690: public const RAID_AM = 2013;
1691: public const TROFF = 2014;
1692: public const CYPRESS = 2015;
1693: public const BOOTSERVER = 2016;
1694: public const CYPRESS_STAT = 2017;
1695: public const TERMINALDB = 2018;
1696: public const WHOSOCKAMI = 2019;
1697: public const XINUPAGESERVER = 2020;
1698: public const SERVEXEC = 2021;
1699: public const DOWN = 2022;
1700: public const XINUEXPANSION3 = 2023;
1701: public const XINUEXPANSION4 = 2024;
1702: public const ELLPACK = 2025;
1703: public const SCRABBLE = 2026;
1704: public const SHADOWSERVER = 2027;
1705: public const SUBMITSERVER = 2028;
1706: public const HSRPV6 = 2029;
1707: public const DEVICE2 = 2030;
1708: public const MOBRIEN_CHAT = 2031;
1709: public const BLACKBOARD = 2032;
1710: public const GLOGGER = 2033;
1711: public const SCOREMGR = 2034;
1712: public const IMSLDOC = 2035;
1713: public const E_DPNET = 2036;
1714: public const APPLUS = 2037;
1715: public const OBJECTMANAGER = 2038;
1716: public const PRIZMA = 2039;
1717: public const LAM = 2040;
1718: public const INTERBASE = 2041;
1719: public const ISIS = 2042;
1720: public const ISIS_BCAST = 2043;
1721: public const RIMSL = 2044;
1722: public const CDFUNC = 2045;
1723: public const SDFUNC = 2046;
1724: public const DLS_2 = 2047;
1725: public const DLS_MONITOR = 2048;
1726: public const SHILP = 2049;
1727: public const NFS = 2049;
1728: public const AV_EMB_CONFIG = 2050;
1729: public const EPNSDP = 2051;
1730: public const CLEARVISN = 2052;
1731: public const LOT105_DS_UPD = 2053;
1732: public const WEBLOGIN = 2054;
1733: public const IOP = 2055;
1734: public const OMNISKY = 2056;
1735: public const RICH_CP = 2057;
1736: public const NEWWAVESEARCH = 2058;
1737: public const BMC_MESSAGING = 2059;
1738: public const TELENIUMDAEMON = 2060;
1739: public const NETMOUNT = 2061;
1740: public const ICG_SWP = 2062;
1741: public const ICG_BRIDGE = 2063;
1742: public const ICG_IPRELAY = 2064;
1743: public const DLSRPN = 2065;
1744: public const AURA = 2066;
1745: public const DLSWPN = 2067;
1746: public const AVAUTHSRVPRTCL = 2068;
1747: public const EVENT_PORT = 2069;
1748: public const AH_ESP_ENCAP = 2070;
1749: public const ACP_PORT = 2071;
1750: public const MSYNC = 2072;
1751: public const GXS_DATA_PORT = 2073;
1752: public const VRTL_VMF_SA = 2074;
1753: public const NEWLIXENGINE = 2075;
1754: public const NEWLIXCONFIG = 2076;
1755: public const TSRMAGT = 2077;
1756: public const TPCSRVR = 2078;
1757: public const IDWARE_ROUTER = 2079;
1758: public const AUTODESK_NLM = 2080;
1759: public const KME_TRAP_PORT = 2081;
1760: public const INFOWAVE = 2082;
1761: public const RADSEC = 2083;
1762: public const SUNCLUSTERGEO = 2084;
1763: public const ADA_CIP = 2085;
1764: public const GNUNET = 2086;
1765: public const ELI = 2087;
1766: public const IP_BLF = 2088;
1767: public const SEP = 2089;
1768: public const LRP = 2090;
1769: public const PRP = 2091;
1770: public const DESCENT3 = 2092;
1771: public const NBX_CC = 2093;
1772: public const NBX_AU = 2094;
1773: public const NBX_SER = 2095;
1774: public const NBX_DIR = 2096;
1775: public const JETFORMPREVIEW = 2097;
1776: public const DIALOG_PORT = 2098;
1777: public const H2250_ANNEX_G = 2099;
1778: public const AMIGANETFS = 2100;
1779: public const RTCM_SC104 = 2101;
1780: public const ZEPHYR_SRV = 2102;
1781: public const ZEPHYR_CLT = 2103;
1782: public const ZEPHYR_HM = 2104;
1783: public const MINIPAY = 2105;
1784: public const MZAP = 2106;
1785: public const BINTEC_ADMIN = 2107;
1786: public const COMCAM = 2108;
1787: public const ERGOLIGHT = 2109;
1788: public const UMSP = 2110;
1789: public const DSATP = 2111;
1790: public const IDONIX_METANET = 2112;
1791: public const HSL_STORM = 2113;
1792: public const ARIASCRIBE = 2114;
1793: public const KDM = 2115;
1794: public const CCOWCMR = 2116;
1795: public const MENTACLIENT = 2117;
1796: public const MENTASERVER = 2118;
1797: public const GSIGATEKEEPER = 2119;
1798: public const QENCP = 2120;
1799: public const SCIENTIA_SSDB = 2121;
1800: public const CAUPC_REMOTE = 2122;
1801: public const GTP_CONTROL = 2123;
1802: public const ELATELINK = 2124;
1803: public const LOCKSTEP = 2125;
1804: public const PKTCABLE_COPS = 2126;
1805: public const INDEX_PC_WB = 2127;
1806: public const NET_STEWARD = 2128;
1807: public const CS_LIVE = 2129;
1808: public const XDS = 2130;
1809: public const AVANTAGEB2B = 2131;
1810: public const SOLERA_EPMAP = 2132;
1811: public const ZYMED_ZPP = 2133;
1812: public const AVENUE = 2134;
1813: public const GRIS = 2135;
1814: public const APPWORXSRV = 2136;
1815: public const CONNECT = 2137;
1816: public const UNBIND_CLUSTER = 2138;
1817: public const IAS_AUTH = 2139;
1818: public const IAS_REG = 2140;
1819: public const IAS_ADMIND = 2141;
1820: public const TDMOIP = 2142;
1821: public const LV_JC = 2143;
1822: public const LV_FFX = 2144;
1823: public const LV_PICI = 2145;
1824: public const LV_NOT = 2146;
1825: public const LV_AUTH = 2147;
1826: public const VERITAS_UCL = 2148;
1827: public const ACPTSYS = 2149;
1828: public const DYNAMIC3D = 2150;
1829: public const DOCENT = 2151;
1830: public const GTP_USER = 2152;
1831: public const CTLPTC = 2153;
1832: public const STDPTC = 2154;
1833: public const BRDPTC = 2155;
1834: public const TRP = 2156;
1835: public const XNDS = 2157;
1836: public const TOUCHNETPLUS = 2158;
1837: public const GDBREMOTE = 2159;
1838: public const APC_2160 = 2160;
1839: public const APC_2161 = 2161;
1840: public const NAVISPHERE = 2162;
1841: public const NAVISPHERE_SEC = 2163;
1842: public const DDNS_V3 = 2164;
1843: public const X_BONE_API = 2165;
1844: public const IWSERVER = 2166;
1845: public const RAW_SERIAL = 2167;
1846: public const EASY_SOFT_MUX = 2168;
1847: public const BRAIN = 2169;
1848: public const EYETV = 2170;
1849: public const MSFW_STORAGE = 2171;
1850: public const MSFW_S_STORAGE = 2172;
1851: public const MSFW_REPLICA = 2173;
1852: public const MSFW_ARRAY = 2174;
1853: public const AIRSYNC = 2175;
1854: public const RAPI = 2176;
1855: public const QWAVE = 2177;
1856: public const BITSPEER = 2178;
1857: public const VMRDP = 2179;
1858: public const MC_GT_SRV = 2180;
1859: public const EFORWARD = 2181;
1860: public const CGN_STAT = 2182;
1861: public const CGN_CONFIG = 2183;
1862: public const NVD = 2184;
1863: public const ONBASE_DDS = 2185;
1864: public const GTAUA = 2186;
1865: public const SSMC = 2187;
1866: public const RADWARE_RPM = 2188;
1867: public const RADWARE_RPM_S = 2189;
1868: public const TIVOCONNECT = 2190;
1869: public const TVBUS = 2191;
1870: public const ASDIS = 2192;
1871: public const DRWCS = 2193;
1872: public const MNP_EXCHANGE = 2197;
1873: public const ONEHOME_REMOTE = 2198;
1874: public const ONEHOME_HELP = 2199;
1875: public const ICI = 2200;
1876: public const ATS = 2201;
1877: public const IMTC_MAP = 2202;
1878: public const B2_RUNTIME = 2203;
1879: public const B2_LICENSE = 2204;
1880: public const JPS = 2205;
1881: public const HPOCBUS = 2206;
1882: public const HPSSD = 2207;
1883: public const HPIOD = 2208;
1884: public const RIMF_PS = 2209;
1885: public const NOAAPORT = 2210;
1886: public const EMWIN = 2211;
1887: public const LEECOPOSSERVER = 2212;
1888: public const KALI = 2213;
1889: public const RPI = 2214;
1890: public const IPCORE = 2215;
1891: public const VTU_COMMS = 2216;
1892: public const GOTODEVICE = 2217;
1893: public const BOUNZZA = 2218;
1894: public const NETIQ_NCAP = 2219;
1895: public const NETIQ = 2220;
1896: public const ETHERNET_IP_S = 2221;
1897: public const ETHERNET_IP_1 = 2222;
1898: public const ROCKWELL_CSP2 = 2223;
1899: public const EFI_MG = 2224;
1900: public const RCIP_ITU = 2225;
1901: public const DI_DRM = 2226;
1902: public const DI_MSG = 2227;
1903: public const EHOME_MS = 2228;
1904: public const DATALENS = 2229;
1905: public const QUEUEADM = 2230;
1906: public const WIMAXASNCP = 2231;
1907: public const IVS_VIDEO = 2232;
1908: public const INFOCRYPT = 2233;
1909: public const DIRECTPLAY = 2234;
1910: public const SERCOMM_WLINK = 2235;
1911: public const NANI = 2236;
1912: public const OPTECH_PORT1_LM = 2237;
1913: public const AVIVA_SNA = 2238;
1914: public const IMAGEQUERY = 2239;
1915: public const RECIPE = 2240;
1916: public const IVSD = 2241;
1917: public const FOLIOCORP = 2242;
1918: public const MAGICOM = 2243;
1919: public const NMSSERVER = 2244;
1920: public const HAO = 2245;
1921: public const PC_MTA_ADDRMAP = 2246;
1922: public const ANTIDOTEMGRSVR = 2247;
1923: public const UMS = 2248;
1924: public const RFMP = 2249;
1925: public const REMOTE_COLLAB = 2250;
1926: public const DIF_PORT = 2251;
1927: public const NJENET_SSL = 2252;
1928: public const DTV_CHAN_REQ = 2253;
1929: public const SEISPOC = 2254;
1930: public const VRTP = 2255;
1931: public const PCC_MFP = 2256;
1932: public const SIMPLE_TX_RX = 2257;
1933: public const RCTS = 2258;
1934: public const APC_2260 = 2260;
1935: public const COMOTIONMASTER = 2261;
1936: public const COMOTIONBACK = 2262;
1937: public const ECWCFG = 2263;
1938: public const APX500API_1 = 2264;
1939: public const APX500API_2 = 2265;
1940: public const MFSERVER = 2266;
1941: public const ONTOBROKER = 2267;
1942: public const AMT = 2268;
1943: public const MIKEY = 2269;
1944: public const STARSCHOOL = 2270;
1945: public const MMCALS = 2271;
1946: public const MMCAL = 2272;
1947: public const MYSQL_IM = 2273;
1948: public const PCTTUNNELL = 2274;
1949: public const IBRIDGE_DATA = 2275;
1950: public const IBRIDGE_MGMT = 2276;
1951: public const BLUECTRLPROXY = 2277;
1952: public const S3DB = 2278;
1953: public const XMQUERY = 2279;
1954: public const LNVPOLLER = 2280;
1955: public const LNVCONSOLE = 2281;
1956: public const LNVALARM = 2282;
1957: public const LNVSTATUS = 2283;
1958: public const LNVMAPS = 2284;
1959: public const LNVMAILMON = 2285;
1960: public const NAS_METERING = 2286;
1961: public const DNA = 2287;
1962: public const NETML = 2288;
1963: public const DICT_LOOKUP = 2289;
1964: public const SONUS_LOGGING = 2290;
1965: public const EAPSP = 2291;
1966: public const MIB_STREAMING = 2292;
1967: public const NPDBGMNGR = 2293;
1968: public const KONSHUS_LM = 2294;
1969: public const ADVANT_LM = 2295;
1970: public const THETA_LM = 2296;
1971: public const D2K_DATAMOVER1 = 2297;
1972: public const D2K_DATAMOVER2 = 2298;
1973: public const PC_TELECOMMUTE = 2299;
1974: public const CVMMON = 2300;
1975: public const CPQ_WBEM = 2301;
1976: public const BINDERYSUPPORT = 2302;
1977: public const PROXY_GATEWAY = 2303;
1978: public const ATTACHMATE_UTS = 2304;
1979: public const MT_SCALESERVER = 2305;
1980: public const TAPPI_BOXNET = 2306;
1981: public const PEHELP = 2307;
1982: public const SDHELP = 2308;
1983: public const SDSERVER = 2309;
1984: public const SDCLIENT = 2310;
1985: public const MESSAGESERVICE = 2311;
1986: public const WANSCALER = 2312;
1987: public const IAPP = 2313;
1988: public const CR_WEBSYSTEMS = 2314;
1989: public const PRECISE_SFT = 2315;
1990: public const SENT_LM = 2316;
1991: public const ATTACHMATE_G32 = 2317;
1992: public const CADENCECONTROL = 2318;
1993: public const INFOLIBRIA = 2319;
1994: public const SIEBEL_NS = 2320;
1995: public const RDLAP = 2321;
1996: public const OFSD = 2322;
1997: public const _3D_NFSD = 2323;
1998: public const COSMOCALL = 2324;
1999: public const ANSYSLI = 2325;
2000: public const IDCP = 2326;
2001: public const XINGCSM = 2327;
2002: public const NETRIX_SFTM = 2328;
2003: public const NVD_2 = 2329;
2004: public const TSCCHAT = 2330;
2005: public const AGENTVIEW = 2331;
2006: public const RCC_HOST = 2332;
2007: public const SNAPP = 2333;
2008: public const ACE_CLIENT = 2334;
2009: public const ACE_PROXY = 2335;
2010: public const APPLEUGCONTROL = 2336;
2011: public const IDEESRV = 2337;
2012: public const NORTON_LAMBERT = 2338;
2013: public const _3COM_WEBVIEW = 2339;
2014: public const WRS_REGISTRY = 2340;
2015: public const XIOSTATUS = 2341;
2016: public const MANAGE_EXEC = 2342;
2017: public const NATI_LOGOS = 2343;
2018: public const FCMSYS = 2344;
2019: public const DBM = 2345;
2020: public const REDSTORM_JOIN = 2346;
2021: public const REDSTORM_FIND = 2347;
2022: public const REDSTORM_INFO = 2348;
2023: public const REDSTORM_DIAG = 2349;
2024: public const PSBSERVER = 2350;
2025: public const PSRSERVER = 2351;
2026: public const PSLSERVER = 2352;
2027: public const PSPSERVER = 2353;
2028: public const PSPRSERVER = 2354;
2029: public const PSDBSERVER = 2355;
2030: public const GXTELMD = 2356;
2031: public const UNIHUB_SERVER = 2357;
2032: public const FUTRIX = 2358;
2033: public const FLUKESERVER = 2359;
2034: public const NEXSTORINDLTD = 2360;
2035: public const TL1 = 2361;
2036: public const DIGIMAN = 2362;
2037: public const MEDIACNTRLNFSD = 2363;
2038: public const OI_2000 = 2364;
2039: public const DBREF = 2365;
2040: public const QIP_LOGIN = 2366;
2041: public const SERVICE_CTRL = 2367;
2042: public const OPENTABLE = 2368;
2043: public const L3_HBMON = 2370;
2044: public const HP_RDA = 2371;
2045: public const LANMESSENGER = 2372;
2046: public const REMOGRAPHLM = 2373;
2047: public const HYDRA = 2374;
2048: public const DOCKER = 2375;
2049: public const DOCKER_S = 2376;
2050: public const SWARM = 2377;
2051: public const ETCD_CLIENT = 2379;
2052: public const ETCD_SERVER = 2380;
2053: public const COMPAQ_HTTPS = 2381;
2054: public const MS_OLAP3 = 2382;
2055: public const MS_OLAP4 = 2383;
2056: public const SD_REQUEST = 2384;
2057: public const SD_DATA = 2385;
2058: public const VIRTUALTAPE = 2386;
2059: public const VSAMREDIRECTOR = 2387;
2060: public const MYNAHAUTOSTART = 2388;
2061: public const OVSESSIONMGR = 2389;
2062: public const RSMTP = 2390;
2063: public const _3COM_NET_MGMT = 2391;
2064: public const TACTICALAUTH = 2392;
2065: public const MS_OLAP1 = 2393;
2066: public const MS_OLAP2 = 2394;
2067: public const LAN900_REMOTE = 2395;
2068: public const WUSAGE = 2396;
2069: public const NCL = 2397;
2070: public const ORBITER = 2398;
2071: public const FMPRO_FDAL = 2399;
2072: public const OPEQUUS_SERVER = 2400;
2073: public const CVSPSERVER = 2401;
2074: public const TASKMASTER2000 = 2402;
2075: public const TASKMASTER2000_2 = 2403;
2076: public const IEC_104 = 2404;
2077: public const TRC_NETPOLL = 2405;
2078: public const JEDISERVER = 2406;
2079: public const ORION = 2407;
2080: public const RAILGUN_WEBACCL = 2408;
2081: public const SNS_PROTOCOL = 2409;
2082: public const VRTS_REGISTRY = 2410;
2083: public const NETWAVE_AP_MGMT = 2411;
2084: public const CDN = 2412;
2085: public const ORION_RMI_REG = 2413;
2086: public const BEEYOND = 2414;
2087: public const CODIMA_RTP = 2415;
2088: public const RMTSERVER = 2416;
2089: public const COMPOSIT_SERVER = 2417;
2090: public const CAS = 2418;
2091: public const ATTACHMATE_S2S = 2419;
2092: public const DSLREMOTE_MGMT = 2420;
2093: public const G_TALK = 2421;
2094: public const CRMSBITS = 2422;
2095: public const RNRP = 2423;
2096: public const KOFAX_SVR = 2424;
2097: public const FJITSUAPPMGR = 2425;
2098: public const VCMP = 2426;
2099: public const MGCP_GATEWAY = 2427;
2100: public const OTT = 2428;
2101: public const FT_ROLE = 2429;
2102: public const VENUS = 2430;
2103: public const VENUS_SE = 2431;
2104: public const CODASRV = 2432;
2105: public const CODASRV_SE = 2433;
2106: public const PXC_EPMAP = 2434;
2107: public const OPTILOGIC = 2435;
2108: public const TOPX = 2436;
2109: public const UNICONTROL = 2437;
2110: public const MSP_2 = 2438;
2111: public const SYBASEDBSYNCH = 2439;
2112: public const SPEARWAY = 2440;
2113: public const PVSW_INET = 2441;
2114: public const NETANGEL = 2442;
2115: public const POWERCLIENTCSF = 2443;
2116: public const BTPP2SECTRANS = 2444;
2117: public const DTN1 = 2445;
2118: public const BUES_SERVICE = 2446;
2119: public const OVWDB = 2447;
2120: public const HPPPSSVR = 2448;
2121: public const RATL = 2449;
2122: public const NETADMIN = 2450;
2123: public const NETCHAT = 2451;
2124: public const SNIFFERCLIENT = 2452;
2125: public const MADGE_LTD = 2453;
2126: public const INDX_DDS = 2454;
2127: public const WAGO_IO_SYSTEM = 2455;
2128: public const ALTAV_REMMGT = 2456;
2129: public const RAPIDO_IP = 2457;
2130: public const GRIFFIN = 2458;
2131: public const COMMUNITY = 2459;
2132: public const MS_THEATER = 2460;
2133: public const QADMIFOPER = 2461;
2134: public const QADMIFEVENT = 2462;
2135: public const LSI_RAID_MGMT = 2463;
2136: public const DIRECPC_SI = 2464;
2137: public const LBM = 2465;
2138: public const LBF = 2466;
2139: public const HIGH_CRITERIA = 2467;
2140: public const QIP_MSGD = 2468;
2141: public const MTI_TCS_COMM = 2469;
2142: public const TASKMAN_PORT = 2470;
2143: public const SEAODBC = 2471;
2144: public const C3 = 2472;
2145: public const AKER_CDP = 2473;
2146: public const VITALANALYSIS = 2474;
2147: public const ACE_SERVER = 2475;
2148: public const ACE_SVR_PROP = 2476;
2149: public const SSM_CVS = 2477;
2150: public const SSM_CSSPS = 2478;
2151: public const SSM_ELS = 2479;
2152: public const POWEREXCHANGE = 2480;
2153: public const GIOP = 2481;
2154: public const GIOP_SSL = 2482;
2155: public const TTC = 2483;
2156: public const TTC_SSL = 2484;
2157: public const NETOBJECTS1 = 2485;
2158: public const NETOBJECTS2 = 2486;
2159: public const PNS = 2487;
2160: public const MOY_CORP = 2488;
2161: public const TSILB = 2489;
2162: public const QIP_QDHCP = 2490;
2163: public const CONCLAVE_CPP = 2491;
2164: public const GROOVE = 2492;
2165: public const TALARIAN_MQS = 2493;
2166: public const BMC_AR = 2494;
2167: public const FAST_REM_SERV = 2495;
2168: public const DIRGIS = 2496;
2169: public const QUADDB = 2497;
2170: public const ODN_CASTRAQ = 2498;
2171: public const UNICONTROL_2 = 2499;
2172: public const RTSSERV = 2500;
2173: public const RTSCLIENT = 2501;
2174: public const KENTROX_PROT = 2502;
2175: public const NMS_DPNSS = 2503;
2176: public const WLBS = 2504;
2177: public const PPCONTROL = 2505;
2178: public const JBROKER = 2506;
2179: public const SPOCK = 2507;
2180: public const JDATASTORE = 2508;
2181: public const FJMPSS = 2509;
2182: public const FJAPPMGRBULK = 2510;
2183: public const METASTORM = 2511;
2184: public const CITRIXIMA = 2512;
2185: public const CITRIXADMIN = 2513;
2186: public const FACSYS_NTP = 2514;
2187: public const FACSYS_ROUTER = 2515;
2188: public const MAINCONTROL = 2516;
2189: public const CALL_SIG_TRANS = 2517;
2190: public const WILLY = 2518;
2191: public const GLOBMSGSVC = 2519;
2192: public const PVSW = 2520;
2193: public const ADAPTECMGR = 2521;
2194: public const WINDB = 2522;
2195: public const QKE_LLC_V3 = 2523;
2196: public const OPTIWAVE_LM = 2524;
2197: public const MS_V_WORLDS = 2525;
2198: public const EMA_SENT_LM = 2526;
2199: public const IQSERVER = 2527;
2200: public const NCR_CCL = 2528;
2201: public const UTSFTP = 2529;
2202: public const VRCOMMERCE = 2530;
2203: public const ITO_E_GUI = 2531;
2204: public const OVTOPMD = 2532;
2205: public const SNIFFERSERVER = 2533;
2206: public const COMBOX_WEB_ACC = 2534;
2207: public const MADCAP = 2535;
2208: public const BTPP2AUDCTR1 = 2536;
2209: public const UPGRADE = 2537;
2210: public const VNWK_PRAPI = 2538;
2211: public const VSIADMIN = 2539;
2212: public const LONWORKS = 2540;
2213: public const LONWORKS2 = 2541;
2214: public const UDRAWGRAPH = 2542;
2215: public const REFTEK = 2543;
2216: public const NOVELL_ZEN = 2544;
2217: public const SIS_EMT = 2545;
2218: public const VYTALVAULTBRTP = 2546;
2219: public const VYTALVAULTVSMP = 2547;
2220: public const VYTALVAULTPIPE = 2548;
2221: public const IPASS = 2549;
2222: public const ADS = 2550;
2223: public const ISG_UDA_SERVER = 2551;
2224: public const CALL_LOGGING = 2552;
2225: public const EFIDININGPORT = 2553;
2226: public const VCNET_LINK_V10 = 2554;
2227: public const COMPAQ_WCP = 2555;
2228: public const NICETEC_NMSVC = 2556;
2229: public const NICETEC_MGMT = 2557;
2230: public const PCLEMULTIMEDIA = 2558;
2231: public const LSTP = 2559;
2232: public const LABRAT = 2560;
2233: public const MOSAIXCC = 2561;
2234: public const DELIBO = 2562;
2235: public const CTI_REDWOOD = 2563;
2236: public const HP_3000_TELNET = 2564;
2237: public const COORD_SVR = 2565;
2238: public const PCS_PCW = 2566;
2239: public const CLP = 2567;
2240: public const SPAMTRAP = 2568;
2241: public const SONUSCALLSIG = 2569;
2242: public const HS_PORT = 2570;
2243: public const CECSVC = 2571;
2244: public const IBP = 2572;
2245: public const TRUSTESTABLISH = 2573;
2246: public const BLOCKADE_BPSP = 2574;
2247: public const HL7 = 2575;
2248: public const TCLPRODEBUGGER = 2576;
2249: public const SCIPTICSLSRVR = 2577;
2250: public const RVS_ISDN_DCP = 2578;
2251: public const MPFONCL = 2579;
2252: public const TRIBUTARY = 2580;
2253: public const ARGIS_TE = 2581;
2254: public const ARGIS_DS = 2582;
2255: public const MON = 2583;
2256: public const CYASERV = 2584;
2257: public const NETX_SERVER = 2585;
2258: public const NETX_AGENT = 2586;
2259: public const MASC = 2587;
2260: public const PRIVILEGE = 2588;
2261: public const QUARTUS_TCL = 2589;
2262: public const IDOTDIST = 2590;
2263: public const MAYTAGSHUFFLE = 2591;
2264: public const NETREK = 2592;
2265: public const MNS_MAIL = 2593;
2266: public const DTS = 2594;
2267: public const WORLDFUSION1 = 2595;
2268: public const WORLDFUSION2 = 2596;
2269: public const HOMESTEADGLORY = 2597;
2270: public const CITRIXIMACLIENT = 2598;
2271: public const SNAPD = 2599;
2272: public const HPSTGMGR = 2600;
2273: public const DISCP_CLIENT = 2601;
2274: public const DISCP_SERVER = 2602;
2275: public const SERVICEMETER = 2603;
2276: public const NSC_CCS = 2604;
2277: public const NSC_POSA = 2605;
2278: public const NETMON = 2606;
2279: public const CONNECTION = 2607;
2280: public const WAG_SERVICE = 2608;
2281: public const SYSTEM_MONITOR = 2609;
2282: public const VERSA_TEK = 2610;
2283: public const LIONHEAD = 2611;
2284: public const QPASA_AGENT = 2612;
2285: public const SMNTUBOOTSTRAP = 2613;
2286: public const NEVEROFFLINE = 2614;
2287: public const FIREPOWER = 2615;
2288: public const APPSWITCH_EMP = 2616;
2289: public const CMADMIN = 2617;
2290: public const PRIORITY_E_COM = 2618;
2291: public const BRUCE = 2619;
2292: public const LPSRECOMMENDER = 2620;
2293: public const MILES_APART = 2621;
2294: public const METRICADBC = 2622;
2295: public const LMDP = 2623;
2296: public const ARIA = 2624;
2297: public const BLWNKL_PORT = 2625;
2298: public const GBJD816 = 2626;
2299: public const MOSHEBEERI = 2627;
2300: public const DICT = 2628;
2301: public const SITARASERVER = 2629;
2302: public const SITARAMGMT = 2630;
2303: public const SITARADIR = 2631;
2304: public const IRDG_POST = 2632;
2305: public const INTERINTELLI = 2633;
2306: public const PK_ELECTRONICS = 2634;
2307: public const BACKBURNER = 2635;
2308: public const SOLVE = 2636;
2309: public const IMDOCSVC = 2637;
2310: public const SYBASEANYWHERE = 2638;
2311: public const AMINET = 2639;
2312: public const AMI_CONTROL = 2640;
2313: public const HDL_SRV = 2641;
2314: public const TRAGIC = 2642;
2315: public const GTE_SAMP = 2643;
2316: public const TRAVSOFT_IPX_T = 2644;
2317: public const NOVELL_IPX_CMD = 2645;
2318: public const AND_LM = 2646;
2319: public const SYNCSERVER = 2647;
2320: public const UPSNOTIFYPROT = 2648;
2321: public const VPSIPPORT = 2649;
2322: public const ERISTWOGUNS = 2650;
2323: public const EBINSITE = 2651;
2324: public const INTERPATHPANEL = 2652;
2325: public const SONUS = 2653;
2326: public const COREL_VNCADMIN = 2654;
2327: public const UNGLUE = 2655;
2328: public const KANA = 2656;
2329: public const SNS_DISPATCHER = 2657;
2330: public const SNS_ADMIN = 2658;
2331: public const SNS_QUERY = 2659;
2332: public const GCMONITOR = 2660;
2333: public const OLHOST = 2661;
2334: public const BINTEC_CAPI = 2662;
2335: public const BINTEC_TAPI = 2663;
2336: public const PATROL_MQ_GM = 2664;
2337: public const PATROL_MQ_NM = 2665;
2338: public const EXTENSIS = 2666;
2339: public const ALARM_CLOCK_S = 2667;
2340: public const ALARM_CLOCK_C = 2668;
2341: public const TOAD = 2669;
2342: public const TVE_ANNOUNCE = 2670;
2343: public const NEWLIXREG = 2671;
2344: public const NHSERVER = 2672;
2345: public const FIRSTCALL42 = 2673;
2346: public const EWNN = 2674;
2347: public const TTC_ETAP = 2675;
2348: public const SIMSLINK = 2676;
2349: public const GADGETGATE1WAY = 2677;
2350: public const GADGETGATE2WAY = 2678;
2351: public const SYNCSERVERSSL = 2679;
2352: public const PXC_SAPXOM = 2680;
2353: public const MPNJSOMB = 2681;
2354: public const NCDLOADBALANCE = 2683;
2355: public const MPNJSOSV = 2684;
2356: public const MPNJSOCL = 2685;
2357: public const MPNJSOMG = 2686;
2358: public const PQ_LIC_MGMT = 2687;
2359: public const MD_CG_HTTP = 2688;
2360: public const FASTLYNX = 2689;
2361: public const HP_NNM_DATA = 2690;
2362: public const ITINTERNET = 2691;
2363: public const ADMINS_LMS = 2692;
2364: public const PWRSEVENT = 2694;
2365: public const VSPREAD = 2695;
2366: public const UNIFYADMIN = 2696;
2367: public const OCE_SNMP_TRAP = 2697;
2368: public const MCK_IVPIP = 2698;
2369: public const CSOFT_PLUSCLNT = 2699;
2370: public const TQDATA = 2700;
2371: public const SMS_RCINFO = 2701;
2372: public const SMS_XFER = 2702;
2373: public const SMS_CHAT = 2703;
2374: public const SMS_REMCTRL = 2704;
2375: public const SDS_ADMIN = 2705;
2376: public const NCDMIRRORING = 2706;
2377: public const EMCSYMAPIPORT = 2707;
2378: public const BANYAN_NET = 2708;
2379: public const SUPERMON = 2709;
2380: public const SSO_SERVICE = 2710;
2381: public const SSO_CONTROL = 2711;
2382: public const AOCP = 2712;
2383: public const RAVENTBS = 2713;
2384: public const RAVENTDM = 2714;
2385: public const HPSTGMGR2 = 2715;
2386: public const INOVA_IP_DISCO = 2716;
2387: public const PN_REQUESTER = 2717;
2388: public const PN_REQUESTER2 = 2718;
2389: public const SCAN_CHANGE = 2719;
2390: public const WKARS = 2720;
2391: public const SMART_DIAGNOSE = 2721;
2392: public const PROACTIVESRVR = 2722;
2393: public const WATCHDOG_NT = 2723;
2394: public const QOTPS = 2724;
2395: public const MSOLAP_PTP2 = 2725;
2396: public const TAMS = 2726;
2397: public const MGCP_CALLAGENT = 2727;
2398: public const SQDR = 2728;
2399: public const TCIM_CONTROL = 2729;
2400: public const NEC_RAIDPLUS = 2730;
2401: public const FYRE_MESSANGER = 2731;
2402: public const G5M = 2732;
2403: public const SIGNET_CTF = 2733;
2404: public const CCS_SOFTWARE = 2734;
2405: public const NETIQ_MC = 2735;
2406: public const RADWIZ_NMS_SRV = 2736;
2407: public const SRP_FEEDBACK = 2737;
2408: public const NDL_TCP_OIS_GW = 2738;
2409: public const TN_TIMING = 2739;
2410: public const ALARM = 2740;
2411: public const TSB = 2741;
2412: public const TSB2 = 2742;
2413: public const MURX = 2743;
2414: public const HONYAKU = 2744;
2415: public const URBISNET = 2745;
2416: public const CPUDPENCAP = 2746;
2417: public const FJIPPOL_SWRLY = 2747;
2418: public const FJIPPOL_POLSVR = 2748;
2419: public const FJIPPOL_CNSL = 2749;
2420: public const FJIPPOL_PORT1 = 2750;
2421: public const FJIPPOL_PORT2 = 2751;
2422: public const RSISYSACCESS = 2752;
2423: public const DE_SPOT = 2753;
2424: public const APOLLO_CC = 2754;
2425: public const EXPRESSPAY = 2755;
2426: public const SIMPLEMENT_TIE = 2756;
2427: public const CNRP = 2757;
2428: public const APOLLO_STATUS = 2758;
2429: public const APOLLO_GMS = 2759;
2430: public const SABAMS = 2760;
2431: public const DICOM_ISCL = 2761;
2432: public const DICOM_TLS = 2762;
2433: public const DESKTOP_DNA = 2763;
2434: public const DATA_INSURANCE = 2764;
2435: public const QIP_AUDUP = 2765;
2436: public const COMPAQ_SCP = 2766;
2437: public const UADTC = 2767;
2438: public const UACS = 2768;
2439: public const EXCE = 2769;
2440: public const VERONICA = 2770;
2441: public const VERGENCECM = 2771;
2442: public const AURIS = 2772;
2443: public const RBAKCUP1 = 2773;
2444: public const RBAKCUP2 = 2774;
2445: public const SMPP = 2775;
2446: public const RIDGEWAY1 = 2776;
2447: public const RIDGEWAY2 = 2777;
2448: public const GWEN_SONYA = 2778;
2449: public const LBC_SYNC = 2779;
2450: public const LBC_CONTROL = 2780;
2451: public const WHOSELLS = 2781;
2452: public const EVERYDAYRC = 2782;
2453: public const AISES = 2783;
2454: public const WWW_DEV = 2784;
2455: public const AIC_NP = 2785;
2456: public const AIC_ONCRPC = 2786;
2457: public const PICCOLO = 2787;
2458: public const FRYESERV = 2788;
2459: public const MEDIA_AGENT = 2789;
2460: public const PLGPROXY = 2790;
2461: public const MTPORT_REGIST = 2791;
2462: public const F5_GLOBALSITE = 2792;
2463: public const INITLSMSAD = 2793;
2464: public const LIVESTATS = 2795;
2465: public const AC_TECH = 2796;
2466: public const ESP_ENCAP = 2797;
2467: public const TMESIS_UPSHOT = 2798;
2468: public const ICON_DISCOVER = 2799;
2469: public const ACC_RAID = 2800;
2470: public const IGCP = 2801;
2471: public const VERITAS_TCP1 = 2802;
2472: public const BTPRJCTRL = 2803;
2473: public const DVR_ESM = 2804;
2474: public const WTA_WSP_S = 2805;
2475: public const CSPUNI = 2806;
2476: public const CSPMULTI = 2807;
2477: public const J_LAN_P = 2808;
2478: public const CORBALOC = 2809;
2479: public const NETSTEWARD = 2810;
2480: public const GSIFTP = 2811;
2481: public const ATMTCP = 2812;
2482: public const LLM_PASS = 2813;
2483: public const LLM_CSV = 2814;
2484: public const LBC_MEASURE = 2815;
2485: public const LBC_WATCHDOG = 2816;
2486: public const NMSIGPORT = 2817;
2487: public const RMLNK = 2818;
2488: public const FC_FAULTNOTIFY = 2819;
2489: public const UNIVISION = 2820;
2490: public const VRTS_AT_PORT = 2821;
2491: public const KA0WUC = 2822;
2492: public const CQG_NETLAN = 2823;
2493: public const CQG_NETLAN_1 = 2824;
2494: public const SLC_SYSTEMLOG = 2826;
2495: public const SLC_CTRLRLOOPS = 2827;
2496: public const ITM_LM = 2828;
2497: public const SILKP1 = 2829;
2498: public const SILKP2 = 2830;
2499: public const SILKP3 = 2831;
2500: public const SILKP4 = 2832;
2501: public const GLISHD = 2833;
2502: public const EVTP = 2834;
2503: public const EVTP_DATA = 2835;
2504: public const CATALYST = 2836;
2505: public const REPLIWEB = 2837;
2506: public const STARBOT = 2838;
2507: public const NMSIGPORT_2 = 2839;
2508: public const L3_EXPRT = 2840;
2509: public const L3_RANGER = 2841;
2510: public const L3_HAWK = 2842;
2511: public const PDNET = 2843;
2512: public const BPCP_POLL = 2844;
2513: public const BPCP_TRAP = 2845;
2514: public const AIMPP_HELLO = 2846;
2515: public const AIMPP_PORT_REQ = 2847;
2516: public const AMT_BLC_PORT = 2848;
2517: public const FXP_2 = 2849;
2518: public const METACONSOLE = 2850;
2519: public const WEBEMSHTTP = 2851;
2520: public const BEARS_01 = 2852;
2521: public const ISPIPES = 2853;
2522: public const INFOMOVER = 2854;
2523: public const MSRP = 2855;
2524: public const CESDINV = 2856;
2525: public const SIMCTLP = 2857;
2526: public const ECNP = 2858;
2527: public const ACTIVEMEMORY = 2859;
2528: public const DIALPAD_VOICE1 = 2860;
2529: public const DIALPAD_VOICE2 = 2861;
2530: public const TTG_PROTOCOL = 2862;
2531: public const SONARDATA = 2863;
2532: public const ASTROMED_MAIN = 2864;
2533: public const PIT_VPN = 2865;
2534: public const IWLISTENER = 2866;
2535: public const ESPS_PORTAL = 2867;
2536: public const NPEP_MESSAGING = 2868;
2537: public const ICSLAP = 2869;
2538: public const DAISHI = 2870;
2539: public const MSI_SELECTPLAY = 2871;
2540: public const RADIX = 2872;
2541: public const DXMESSAGEBASE1 = 2874;
2542: public const DXMESSAGEBASE2 = 2875;
2543: public const SPS_TUNNEL = 2876;
2544: public const BLUELANCE = 2877;
2545: public const AAP = 2878;
2546: public const UCENTRIC_DS = 2879;
2547: public const SYNAPSE = 2880;
2548: public const NDSP = 2881;
2549: public const NDTP = 2882;
2550: public const NDNP = 2883;
2551: public const FLASHMSG = 2884;
2552: public const TOPFLOW = 2885;
2553: public const RESPONSELOGIC = 2886;
2554: public const AIRONETDDP = 2887;
2555: public const SPCSDLOBBY = 2888;
2556: public const RSOM = 2889;
2557: public const CSPCLMULTI = 2890;
2558: public const CINEGRFX_ELMD = 2891;
2559: public const SNIFFERDATA = 2892;
2560: public const VSECONNECTOR = 2893;
2561: public const ABACUS_REMOTE = 2894;
2562: public const NATUSLINK = 2895;
2563: public const ECOVISIONG6_1 = 2896;
2564: public const CITRIX_RTMP = 2897;
2565: public const APPLIANCE_CFG = 2898;
2566: public const POWERGEMPLUS = 2899;
2567: public const QUICKSUITE = 2900;
2568: public const ALLSTORCNS = 2901;
2569: public const NETASPI = 2902;
2570: public const SUITCASE = 2903;
2571: public const M2UA = 2904;
2572: public const M3UA = 2905;
2573: public const CALLER9 = 2906;
2574: public const WEBMETHODS_B2B = 2907;
2575: public const MAO = 2908;
2576: public const FUNK_DIALOUT = 2909;
2577: public const TDACCESS = 2910;
2578: public const BLOCKADE = 2911;
2579: public const EPICON = 2912;
2580: public const BOOSTERWARE = 2913;
2581: public const GAMELOBBY = 2914;
2582: public const TKSOCKET = 2915;
2583: public const ELVIN_SERVER = 2916;
2584: public const ELVIN_CLIENT = 2917;
2585: public const KASTENCHASEPAD = 2918;
2586: public const ROBOER = 2919;
2587: public const ROBOEDA = 2920;
2588: public const CESDCDMAN = 2921;
2589: public const CESDCDTRN = 2922;
2590: public const WTA_WSP_WTP_S = 2923;
2591: public const PRECISE_VIP = 2924;
2592: public const MOBILE_FILE_DL = 2926;
2593: public const UNIMOBILECTRL = 2927;
2594: public const REDSTONE_CPSS = 2928;
2595: public const AMX_WEBADMIN = 2929;
2596: public const AMX_WEBLINX = 2930;
2597: public const CIRCLE_X = 2931;
2598: public const INCP = 2932;
2599: public const _4_TIEROPMGW = 2933;
2600: public const _4_TIEROPMCLI = 2934;
2601: public const QTP = 2935;
2602: public const OTPATCH = 2936;
2603: public const PNACONSULT_LM = 2937;
2604: public const SM_PAS_1 = 2938;
2605: public const SM_PAS_2 = 2939;
2606: public const SM_PAS_3 = 2940;
2607: public const SM_PAS_4 = 2941;
2608: public const SM_PAS_5 = 2942;
2609: public const TTNREPOSITORY = 2943;
2610: public const MEGACO_H248 = 2944;
2611: public const H248_BINARY = 2945;
2612: public const FJSVMPOR = 2946;
2613: public const GPSD = 2947;
2614: public const WAP_PUSH = 2948;
2615: public const WAP_PUSHSECURE = 2949;
2616: public const ESIP = 2950;
2617: public const OTTP = 2951;
2618: public const MPFWSAS = 2952;
2619: public const OVALARMSRV = 2953;
2620: public const OVALARMSRV_CMD = 2954;
2621: public const CSNOTIFY = 2955;
2622: public const OVRIMOSDBMAN = 2956;
2623: public const JMACT5 = 2957;
2624: public const JMACT6 = 2958;
2625: public const RMOPAGT = 2959;
2626: public const DFOXSERVER = 2960;
2627: public const BOLDSOFT_LM = 2961;
2628: public const IPH_POLICY_CLI = 2962;
2629: public const IPH_POLICY_ADM = 2963;
2630: public const BULLANT_SRAP = 2964;
2631: public const BULLANT_RAP = 2965;
2632: public const IDP_INFOTRIEVE = 2966;
2633: public const SSC_AGENT = 2967;
2634: public const ENPP = 2968;
2635: public const ESSP = 2969;
2636: public const INDEX_NET = 2970;
2637: public const NETCLIP = 2971;
2638: public const PMSM_WEBRCTL = 2972;
2639: public const SVNETWORKS = 2973;
2640: public const SIGNAL = 2974;
2641: public const FJMPCM = 2975;
2642: public const CNS_SRV_PORT = 2976;
2643: public const TTC_ETAP_NS = 2977;
2644: public const TTC_ETAP_DS = 2978;
2645: public const H263_VIDEO = 2979;
2646: public const WIMD = 2980;
2647: public const MYLXAMPORT = 2981;
2648: public const IWB_WHITEBOARD = 2982;
2649: public const NETPLAN = 2983;
2650: public const HPIDSADMIN = 2984;
2651: public const HPIDSAGENT = 2985;
2652: public const STONEFALLS = 2986;
2653: public const IDENTIFY = 2987;
2654: public const HIPPAD = 2988;
2655: public const ZARKOV = 2989;
2656: public const BOSCAP = 2990;
2657: public const WKSTN_MON = 2991;
2658: public const AVENYO = 2992;
2659: public const VERITAS_VIS1 = 2993;
2660: public const VERITAS_VIS2 = 2994;
2661: public const IDRS = 2995;
2662: public const VSIXML = 2996;
2663: public const REBOL = 2997;
2664: public const REALSECURE = 2998;
2665: public const REMOTEWARE_UN = 2999;
2666: public const HBCI = 3000;
2667: public const REMOTEWARE_CL = 3000;
2668: public const ORIGO_NATIVE = 3001;
2669: public const EXLM_AGENT = 3002;
2670: public const REMOTEWARE_SRV = 3002;
2671: public const CGMS = 3003;
2672: public const CSOFTRAGENT = 3004;
2673: public const GENIUSLM = 3005;
2674: public const II_ADMIN = 3006;
2675: public const LOTUSMTAP = 3007;
2676: public const MIDNIGHT_TECH = 3008;
2677: public const PXC_NTFY = 3009;
2678: public const GW = 3010;
2679: public const TRUSTED_WEB = 3011;
2680: public const TWSDSS = 3012;
2681: public const GILATSKYSURFER = 3013;
2682: public const BROKER_SERVICE = 3014;
2683: public const NATI_DSTP = 3015;
2684: public const NOTIFY_SRVR = 3016;
2685: public const EVENT_LISTENER = 3017;
2686: public const SRVC_REGISTRY = 3018;
2687: public const RESOURCE_MGR = 3019;
2688: public const CIFS = 3020;
2689: public const AGRISERVER = 3021;
2690: public const CSREGAGENT = 3022;
2691: public const MAGICNOTES = 3023;
2692: public const NDS_SSO = 3024;
2693: public const AREPA_RAFT = 3025;
2694: public const AGRI_GATEWAY = 3026;
2695: public const LIEBDEVMGMT_C = 3027;
2696: public const LIEBDEVMGMT_DM = 3028;
2697: public const LIEBDEVMGMT_A = 3029;
2698: public const AREPA_CAS = 3030;
2699: public const EPPC = 3031;
2700: public const REDWOOD_CHAT = 3032;
2701: public const PDB = 3033;
2702: public const OSMOSIS_AEEA = 3034;
2703: public const FJSV_GSSAGT = 3035;
2704: public const HAGEL_DUMP = 3036;
2705: public const HP_SAN_MGMT = 3037;
2706: public const SANTAK_UPS = 3038;
2707: public const COGITATE = 3039;
2708: public const TOMATO_SPRINGS = 3040;
2709: public const DI_TRACEWARE = 3041;
2710: public const JOURNEE = 3042;
2711: public const BRP = 3043;
2712: public const EPP_2 = 3044;
2713: public const RESPONSENET = 3045;
2714: public const DI_ASE = 3046;
2715: public const HLSERVER = 3047;
2716: public const PCTRADER = 3048;
2717: public const NSWS = 3049;
2718: public const GDS_DB = 3050;
2719: public const GDS_DB_2 = 3050;
2720: public const GALAXY_SERVER = 3051;
2721: public const APC_3052 = 3052;
2722: public const DSOM_SERVER = 3053;
2723: public const AMT_CNF_PROT = 3054;
2724: public const POLICYSERVER = 3055;
2725: public const CDL_SERVER = 3056;
2726: public const GOAHEAD_FLDUP = 3057;
2727: public const VIDEOBEANS = 3058;
2728: public const QSOFT = 3059;
2729: public const INTERSERVER = 3060;
2730: public const CAUTCPD = 3061;
2731: public const NCACN_IP_TCP = 3062;
2732: public const NCADG_IP_UDP = 3063;
2733: public const RPRT = 3064;
2734: public const SLINTERBASE = 3065;
2735: public const NETATTACHSDMP = 3066;
2736: public const FJHPJP = 3067;
2737: public const LS3BCAST = 3068;
2738: public const LS3 = 3069;
2739: public const MGXSWITCH = 3070;
2740: public const XPLAT_REPLICATE = 3071;
2741: public const CSD_MONITOR = 3072;
2742: public const VCRP = 3073;
2743: public const XBOX = 3074;
2744: public const ORBIX_LOCATOR = 3075;
2745: public const ORBIX_CONFIG = 3076;
2746: public const ORBIX_LOC_SSL = 3077;
2747: public const ORBIX_CFG_SSL = 3078;
2748: public const LV_FRONTPANEL = 3079;
2749: public const STM_PPROC = 3080;
2750: public const TL1_LV = 3081;
2751: public const TL1_RAW = 3082;
2752: public const TL1_TELNET = 3083;
2753: public const ITM_MCCS = 3084;
2754: public const PCIHREQ = 3085;
2755: public const JDL_DBKITCHEN = 3086;
2756: public const ASOKI_SMA = 3087;
2757: public const XDTP = 3088;
2758: public const PTK_ALINK = 3089;
2759: public const STSS = 3090;
2760: public const _1CI_SMCS = 3091;
2761: public const RAPIDMQ_CENTER = 3093;
2762: public const RAPIDMQ_REG = 3094;
2763: public const PANASAS = 3095;
2764: public const NDL_APS = 3096;
2765: public const UMM_PORT = 3098;
2766: public const CHMD = 3099;
2767: public const OPCON_XPS = 3100;
2768: public const HP_PXPIB = 3101;
2769: public const SLSLAVEMON = 3102;
2770: public const AUTOCUESMI = 3103;
2771: public const AUTOCUELOG = 3104;
2772: public const CARDBOX = 3105;
2773: public const CARDBOX_HTTP = 3106;
2774: public const BUSINESS = 3107;
2775: public const GEOLOCATE = 3108;
2776: public const PERSONNEL = 3109;
2777: public const SIM_CONTROL = 3110;
2778: public const WSYNCH = 3111;
2779: public const KSYSGUARD = 3112;
2780: public const CS_AUTH_SVR = 3113;
2781: public const CCMAD = 3114;
2782: public const MCTET_MASTER = 3115;
2783: public const MCTET_GATEWAY = 3116;
2784: public const MCTET_JSERV = 3117;
2785: public const PKAGENT = 3118;
2786: public const D2000KERNEL = 3119;
2787: public const D2000WEBSERVER = 3120;
2788: public const PCMK_REMOTE = 3121;
2789: public const VTR_EMULATOR = 3122;
2790: public const EDIX = 3123;
2791: public const BEACON_PORT = 3124;
2792: public const A13_AN = 3125;
2793: public const CTX_BRIDGE = 3127;
2794: public const NDL_AAS = 3128;
2795: public const NETPORT_ID = 3129;
2796: public const ICPV2 = 3130;
2797: public const NETBOOKMARK = 3131;
2798: public const MS_RULE_ENGINE = 3132;
2799: public const PRISM_DEPLOY = 3133;
2800: public const ECP = 3134;
2801: public const PEERBOOK_PORT = 3135;
2802: public const GRUBD = 3136;
2803: public const RTNT_1 = 3137;
2804: public const RTNT_2 = 3138;
2805: public const INCOGNITORV = 3139;
2806: public const ARILIAMULTI = 3140;
2807: public const VMODEM = 3141;
2808: public const RDC_WH_EOS = 3142;
2809: public const SEAVIEW = 3143;
2810: public const TARANTELLA = 3144;
2811: public const CSI_LFAP = 3145;
2812: public const BEARS_02 = 3146;
2813: public const RFIO = 3147;
2814: public const NM_GAME_ADMIN = 3148;
2815: public const NM_GAME_SERVER = 3149;
2816: public const NM_ASSES_ADMIN = 3150;
2817: public const NM_ASSESSOR = 3151;
2818: public const FEITIANROCKEY = 3152;
2819: public const S8_CLIENT_PORT = 3153;
2820: public const CCMRMI = 3154;
2821: public const JPEGMPEG = 3155;
2822: public const INDURA = 3156;
2823: public const E3CONSULTANTS = 3157;
2824: public const STVP = 3158;
2825: public const NAVEGAWEB_PORT = 3159;
2826: public const TIP_APP_SERVER = 3160;
2827: public const DOC1LM = 3161;
2828: public const SFLM = 3162;
2829: public const RES_SAP = 3163;
2830: public const IMPRS = 3164;
2831: public const NEWGENPAY = 3165;
2832: public const SOSSECOLLECTOR = 3166;
2833: public const NOWCONTACT = 3167;
2834: public const POWERONNUD = 3168;
2835: public const SERVERVIEW_AS = 3169;
2836: public const SERVERVIEW_ASN = 3170;
2837: public const SERVERVIEW_GF = 3171;
2838: public const SERVERVIEW_RM = 3172;
2839: public const SERVERVIEW_ICC = 3173;
2840: public const ARMI_SERVER = 3174;
2841: public const T1_E1_OVER_IP = 3175;
2842: public const ARS_MASTER = 3176;
2843: public const PHONEX_PORT = 3177;
2844: public const RADCLIENTPORT = 3178;
2845: public const H2GF_W_2M = 3179;
2846: public const MC_BRK_SRV = 3180;
2847: public const BMCPATROLAGENT = 3181;
2848: public const BMCPATROLRNVU = 3182;
2849: public const COPS_TLS = 3183;
2850: public const APOGEEX_PORT = 3184;
2851: public const SMPPPD = 3185;
2852: public const IIW_PORT = 3186;
2853: public const ODI_PORT = 3187;
2854: public const BRCM_COMM_PORT = 3188;
2855: public const PCLE_INFEX = 3189;
2856: public const CSVR_PROXY = 3190;
2857: public const CSVR_SSLPROXY = 3191;
2858: public const FIREMONRCC = 3192;
2859: public const SPANDATAPORT = 3193;
2860: public const MAGBIND = 3194;
2861: public const NCU_1 = 3195;
2862: public const NCU_2 = 3196;
2863: public const EMBRACE_DP_S = 3197;
2864: public const EMBRACE_DP_C = 3198;
2865: public const DMOD_WORKSPACE = 3199;
2866: public const TICK_PORT = 3200;
2867: public const CPQ_TASKSMART = 3201;
2868: public const INTRAINTRA = 3202;
2869: public const NETWATCHER_MON = 3203;
2870: public const NETWATCHER_DB = 3204;
2871: public const ISNS = 3205;
2872: public const IRONMAIL = 3206;
2873: public const VX_AUTH_PORT = 3207;
2874: public const PFU_PRCALLBACK = 3208;
2875: public const NETWKPATHENGINE = 3209;
2876: public const FLAMENCO_PROXY = 3210;
2877: public const AVSECUREMGMT = 3211;
2878: public const SURVEYINST = 3212;
2879: public const NEON24X7 = 3213;
2880: public const JMQ_DAEMON_1 = 3214;
2881: public const JMQ_DAEMON_2 = 3215;
2882: public const FERRARI_FOAM = 3216;
2883: public const UNITE = 3217;
2884: public const SMARTPACKETS = 3218;
2885: public const WMS_MESSENGER = 3219;
2886: public const XNM_SSL = 3220;
2887: public const XNM_CLEAR_TEXT = 3221;
2888: public const GLBP = 3222;
2889: public const DIGIVOTE = 3223;
2890: public const AES_DISCOVERY = 3224;
2891: public const FCIP_PORT = 3225;
2892: public const ISI_IRP = 3226;
2893: public const DWNMSHTTP = 3227;
2894: public const DWMSGSERVER = 3228;
2895: public const GLOBAL_CD_PORT = 3229;
2896: public const SFTDST_PORT = 3230;
2897: public const VIDIGO = 3231;
2898: public const MDTP = 3232;
2899: public const WHISKER = 3233;
2900: public const ALCHEMY = 3234;
2901: public const MDAP_PORT = 3235;
2902: public const APPARENET_TS = 3236;
2903: public const APPARENET_TPS = 3237;
2904: public const APPARENET_AS = 3238;
2905: public const APPARENET_UI = 3239;
2906: public const TRIOMOTION = 3240;
2907: public const SYSORB = 3241;
2908: public const SDP_ID_PORT = 3242;
2909: public const TIMELOT = 3243;
2910: public const ONESAF = 3244;
2911: public const VIEO_FE = 3245;
2912: public const DVT_SYSTEM = 3246;
2913: public const DVT_DATA = 3247;
2914: public const PROCOS_LM = 3248;
2915: public const SSP = 3249;
2916: public const HICP = 3250;
2917: public const SYSSCANNER = 3251;
2918: public const DHE = 3252;
2919: public const PDA_DATA = 3253;
2920: public const PDA_SYS = 3254;
2921: public const SEMAPHORE = 3255;
2922: public const CPQRPM_AGENT = 3256;
2923: public const CPQRPM_SERVER = 3257;
2924: public const IVECON_PORT = 3258;
2925: public const EPNCDP2 = 3259;
2926: public const ISCSI_TARGET = 3260;
2927: public const WINSHADOW = 3261;
2928: public const NECP = 3262;
2929: public const ECOLOR_IMAGER = 3263;
2930: public const CCMAIL = 3264;
2931: public const ALTAV_TUNNEL = 3265;
2932: public const NS_CFG_SERVER = 3266;
2933: public const IBM_DIAL_OUT = 3267;
2934: public const MSFT_GC = 3268;
2935: public const MSFT_GC_SSL = 3269;
2936: public const VERISMART = 3270;
2937: public const CSOFT_PREV = 3271;
2938: public const USER_MANAGER = 3272;
2939: public const SXMP = 3273;
2940: public const ORDINOX_SERVER = 3274;
2941: public const SAMD = 3275;
2942: public const MAXIM_ASICS = 3276;
2943: public const AWG_PROXY = 3277;
2944: public const LKCMSERVER = 3278;
2945: public const ADMIND = 3279;
2946: public const VS_SERVER = 3280;
2947: public const SYSOPT = 3281;
2948: public const DATUSORB = 3282;
2949: public const APPLE_REMOTE_DESKTOP = 3283;
2950: public const _4TALK = 3284;
2951: public const PLATO = 3285;
2952: public const E_NET = 3286;
2953: public const DIRECTVDATA = 3287;
2954: public const COPS = 3288;
2955: public const ENPC = 3289;
2956: public const CAPS_LM = 3290;
2957: public const SAH_LM = 3291;
2958: public const CART_O_RAMA = 3292;
2959: public const FG_FPS = 3293;
2960: public const FG_GIP = 3294;
2961: public const DYNIPLOOKUP = 3295;
2962: public const RIB_SLM = 3296;
2963: public const CYTEL_LM = 3297;
2964: public const DESKVIEW = 3298;
2965: public const PDRNCS = 3299;
2966: public const CEPH = 3300;
2967: public const MCS_FASTMAIL = 3302;
2968: public const OPSESSION_CLNT = 3303;
2969: public const OPSESSION_SRVR = 3304;
2970: public const ODETTE_FTP = 3305;
2971: public const MYSQL = 3306;
2972: public const OPSESSION_PRXY = 3307;
2973: public const TNS_SERVER = 3308;
2974: public const TNS_ADV = 3309;
2975: public const DYNA_ACCESS = 3310;
2976: public const MCNS_TEL_RET = 3311;
2977: public const APPMAN_SERVER = 3312;
2978: public const UORB = 3313;
2979: public const UOHOST = 3314;
2980: public const CDID = 3315;
2981: public const AICC_CMI = 3316;
2982: public const VSAIPORT = 3317;
2983: public const SSRIP = 3318;
2984: public const SDT_LMD = 3319;
2985: public const OFFICELINK2000 = 3320;
2986: public const VNSSTR = 3321;
2987: public const ACTIVE_NET = 3322;
2988: public const ACTIVE_NET_2 = 3323;
2989: public const ACTIVE_NET_3 = 3324;
2990: public const ACTIVE_NET_4 = 3325;
2991: public const SFTU = 3326;
2992: public const BBARS = 3327;
2993: public const EGPTLM = 3328;
2994: public const HP_DEVICE_DISC = 3329;
2995: public const MCS_CALYPSOICF = 3330;
2996: public const MCS_MESSAGING = 3331;
2997: public const MCS_MAILSVR = 3332;
2998: public const DEC_NOTES = 3333;
2999: public const DIRECTV_WEB = 3334;
3000: public const DIRECTV_SOFT = 3335;
3001: public const DIRECTV_TICK = 3336;
3002: public const DIRECTV_CATLG = 3337;
3003: public const ANET_B = 3338;
3004: public const ANET_L = 3339;
3005: public const ANET_M = 3340;
3006: public const ANET_H = 3341;
3007: public const WEBTIE = 3342;
3008: public const MS_CLUSTER_NET = 3343;
3009: public const BNT_MANAGER = 3344;
3010: public const INFLUENCE = 3345;
3011: public const TRNSPRNTPROXY = 3346;
3012: public const PHOENIX_RPC = 3347;
3013: public const PANGOLIN_LASER = 3348;
3014: public const CHEVINSERVICES = 3349;
3015: public const FINDVIATV = 3350;
3016: public const BTRIEVE = 3351;
3017: public const SSQL = 3352;
3018: public const FATPIPE = 3353;
3019: public const SUITJD = 3354;
3020: public const ORDINOX_DBASE = 3355;
3021: public const UPNOTIFYPS = 3356;
3022: public const ADTECH_TEST = 3357;
3023: public const MPSYSRMSVR = 3358;
3024: public const WG_NETFORCE = 3359;
3025: public const KV_SERVER = 3360;
3026: public const KV_AGENT = 3361;
3027: public const DJ_ILM = 3362;
3028: public const NATI_VI_SERVER = 3363;
3029: public const CREATIVESERVER_2 = 3364;
3030: public const CONTENTSERVER_2 = 3365;
3031: public const CREATIVEPARTNR_2 = 3366;
3032: public const SATVID_DATALNK = 3367;
3033: public const SATVID_DATALNK_2 = 3368;
3034: public const SATVID_DATALNK_3 = 3369;
3035: public const SATVID_DATALNK_4 = 3370;
3036: public const SATVID_DATALNK_5 = 3371;
3037: public const TIP2 = 3372;
3038: public const LAVENIR_LM = 3373;
3039: public const CLUSTER_DISC = 3374;
3040: public const VSNM_AGENT = 3375;
3041: public const CDBROKER = 3376;
3042: public const COGSYS_LM = 3377;
3043: public const WSICOPY = 3378;
3044: public const SOCORFS = 3379;
3045: public const SNS_CHANNELS = 3380;
3046: public const GENEOUS = 3381;
3047: public const FUJITSU_NEAT = 3382;
3048: public const ESP_LM = 3383;
3049: public const HP_CLIC = 3384;
3050: public const QNXNETMAN = 3385;
3051: public const GPRS_DATA = 3386;
3052: public const BACKROOMNET = 3387;
3053: public const CBSERVER = 3388;
3054: public const MS_WBT_SERVER = 3389;
3055: public const DSC = 3390;
3056: public const SAVANT = 3391;
3057: public const EFI_LM = 3392;
3058: public const D2K_TAPESTRY1 = 3393;
3059: public const D2K_TAPESTRY2 = 3394;
3060: public const DYNA_LM = 3395;
3061: public const PRINTER_AGENT = 3396;
3062: public const CLOANTO_LM = 3397;
3063: public const MERCANTILE = 3398;
3064: public const CSMS = 3399;
3065: public const CSMS2 = 3400;
3066: public const FILECAST = 3401;
3067: public const FXAENGINE_NET = 3402;
3068: public const NOKIA_ANN_CH1 = 3405;
3069: public const NOKIA_ANN_CH2 = 3406;
3070: public const LDAP_ADMIN = 3407;
3071: public const BESAPI = 3408;
3072: public const NETWORKLENS = 3409;
3073: public const NETWORKLENSS = 3410;
3074: public const BIOLINK_AUTH = 3411;
3075: public const XMLBLASTER = 3412;
3076: public const SVNET = 3413;
3077: public const WIP_PORT = 3414;
3078: public const BCINAMESERVICE = 3415;
3079: public const COMMANDPORT = 3416;
3080: public const CSVR = 3417;
3081: public const RNMAP = 3418;
3082: public const SOFTAUDIT = 3419;
3083: public const IFCP_PORT = 3420;
3084: public const BMAP = 3421;
3085: public const RUSB_SYS_PORT = 3422;
3086: public const XTRM = 3423;
3087: public const XTRMS = 3424;
3088: public const AGPS_PORT = 3425;
3089: public const ARKIVIO = 3426;
3090: public const WEBSPHERE_SNMP = 3427;
3091: public const TWCSS = 3428;
3092: public const GCSP = 3429;
3093: public const SSDISPATCH = 3430;
3094: public const NDL_ALS = 3431;
3095: public const OSDCP = 3432;
3096: public const OPNET_SMP = 3433;
3097: public const OPENCM = 3434;
3098: public const PACOM = 3435;
3099: public const GC_CONFIG = 3436;
3100: public const AUTOCUEDS = 3437;
3101: public const SPIRAL_ADMIN = 3438;
3102: public const HRI_PORT = 3439;
3103: public const ANS_CONSOLE = 3440;
3104: public const CONNECT_CLIENT = 3441;
3105: public const CONNECT_SERVER = 3442;
3106: public const OV_NNM_WEBSRV = 3443;
3107: public const DENALI_SERVER = 3444;
3108: public const MONP = 3445;
3109: public const _3COMFAXRPC = 3446;
3110: public const DIRECTNET = 3447;
3111: public const DNC_PORT = 3448;
3112: public const HOTU_CHAT = 3449;
3113: public const CASTORPROXY = 3450;
3114: public const ASAM = 3451;
3115: public const SABP_SIGNAL = 3452;
3116: public const PSCUPD = 3453;
3117: public const MIRA = 3454;
3118: public const PRSVP = 3455;
3119: public const VAT = 3456;
3120: public const VAT_CONTROL = 3457;
3121: public const D3WINOSFI = 3458;
3122: public const INTEGRAL = 3459;
3123: public const EDM_MANAGER = 3460;
3124: public const EDM_STAGER = 3461;
3125: public const EDM_STD_NOTIFY = 3462;
3126: public const EDM_ADM_NOTIFY = 3463;
3127: public const EDM_MGR_SYNC = 3464;
3128: public const EDM_MGR_CNTRL = 3465;
3129: public const WORKFLOW = 3466;
3130: public const RCST = 3467;
3131: public const TTCMREMOTECTRL = 3468;
3132: public const PLURIBUS = 3469;
3133: public const JT400 = 3470;
3134: public const JT400_SSL = 3471;
3135: public const JAUGSREMOTEC_1 = 3472;
3136: public const JAUGSREMOTEC_2 = 3473;
3137: public const TTNTSPAUTO = 3474;
3138: public const GENISAR_PORT = 3475;
3139: public const NPPMP = 3476;
3140: public const ECOMM = 3477;
3141: public const STUN = 3478;
3142: public const TURN = 3478;
3143: public const STUN_BEHAVIOR = 3478;
3144: public const TWRPC = 3479;
3145: public const PLETHORA = 3480;
3146: public const CLEANERLIVERC = 3481;
3147: public const VULTURE = 3482;
3148: public const SLIM_DEVICES = 3483;
3149: public const GBS_STP = 3484;
3150: public const CELATALK = 3485;
3151: public const IFSF_HB_PORT = 3486;
3152: public const LTCTCP = 3487;
3153: public const FS_RH_SRV = 3488;
3154: public const DTP_DIA = 3489;
3155: public const COLUBRIS = 3490;
3156: public const SWR_PORT = 3491;
3157: public const TVDUMTRAY_PORT = 3492;
3158: public const NUT = 3493;
3159: public const IBM3494 = 3494;
3160: public const SECLAYER_TCP = 3495;
3161: public const SECLAYER_TLS = 3496;
3162: public const IPETHER232PORT = 3497;
3163: public const DASHPAS_PORT = 3498;
3164: public const SCCIP_MEDIA = 3499;
3165: public const RTMP_PORT = 3500;
3166: public const ISOFT_P2P = 3501;
3167: public const AVINSTALLDISC = 3502;
3168: public const LSP_PING = 3503;
3169: public const IRONSTORM = 3504;
3170: public const CCMCOMM = 3505;
3171: public const APC_3506 = 3506;
3172: public const NESH_BROKER = 3507;
3173: public const INTERACTIONWEB = 3508;
3174: public const VT_SSL = 3509;
3175: public const XSS_PORT = 3510;
3176: public const WEBMAIL_2 = 3511;
3177: public const AZTEC = 3512;
3178: public const ARCPD = 3513;
3179: public const MUST_P2P = 3514;
3180: public const MUST_BACKPLANE = 3515;
3181: public const SMARTCARD_PORT = 3516;
3182: public const _802_11_IAPP = 3517;
3183: public const ARTIFACT_MSG = 3518;
3184: public const NVMSGD = 3519;
3185: public const GALILEOLOG = 3520;
3186: public const MC3SS = 3521;
3187: public const NSSOCKETPORT = 3522;
3188: public const ODEUMSERVLINK = 3523;
3189: public const ECMPORT = 3524;
3190: public const EISPORT = 3525;
3191: public const STARQUIZ_PORT = 3526;
3192: public const BESERVER_MSG_Q = 3527;
3193: public const JBOSS_IIOP = 3528;
3194: public const JBOSS_IIOP_SSL = 3529;
3195: public const GF = 3530;
3196: public const JOLTID = 3531;
3197: public const RAVEN_RMP = 3532;
3198: public const RAVEN_RDP = 3533;
3199: public const URLD_PORT = 3534;
3200: public const MS_LA = 3535;
3201: public const SNAC = 3536;
3202: public const NI_VISA_REMOTE = 3537;
3203: public const IBM_DIRADM = 3538;
3204: public const IBM_DIRADM_SSL = 3539;
3205: public const PNRP_PORT = 3540;
3206: public const VOISPEED_PORT = 3541;
3207: public const HACL_MONITOR = 3542;
3208: public const QFTEST_LOOKUP = 3543;
3209: public const TEREDO = 3544;
3210: public const CAMAC = 3545;
3211: public const SYMANTEC_SIM = 3547;
3212: public const INTERWORLD = 3548;
3213: public const TELLUMAT_NMS = 3549;
3214: public const SSMPP = 3550;
3215: public const APCUPSD = 3551;
3216: public const TASERVER = 3552;
3217: public const RBR_DISCOVERY = 3553;
3218: public const QUESTNOTIFY = 3554;
3219: public const RAZOR = 3555;
3220: public const SKY_TRANSPORT = 3556;
3221: public const PERSONALOS_001 = 3557;
3222: public const MCP_PORT = 3558;
3223: public const CCTV_PORT = 3559;
3224: public const INISERVE_PORT = 3560;
3225: public const BMC_ONEKEY = 3561;
3226: public const SDBPROXY = 3562;
3227: public const WATCOMDEBUG = 3563;
3228: public const ESIMPORT = 3564;
3229: public const M2PA = 3565;
3230: public const QUEST_DATA_HUB = 3566;
3231: public const DOF_EPS = 3567;
3232: public const DOF_TUNNEL_SEC = 3568;
3233: public const MBG_CTRL = 3569;
3234: public const MCCWEBSVR_PORT = 3570;
3235: public const MEGARDSVR_PORT = 3571;
3236: public const MEGAREGSVRPORT = 3572;
3237: public const TAG_UPS_1 = 3573;
3238: public const DMAF_SERVER = 3574;
3239: public const CCM_PORT = 3575;
3240: public const CMC_PORT = 3576;
3241: public const CONFIG_PORT = 3577;
3242: public const DATA_PORT = 3578;
3243: public const TTAT3LB = 3579;
3244: public const NATI_SVRLOC = 3580;
3245: public const KFXACLICENSING = 3581;
3246: public const PRESS = 3582;
3247: public const CANEX_WATCH = 3583;
3248: public const U_DBAP = 3584;
3249: public const EMPRISE_LLS = 3585;
3250: public const EMPRISE_LSC = 3586;
3251: public const P2PGROUP = 3587;
3252: public const SENTINEL = 3588;
3253: public const ISOMAIR = 3589;
3254: public const WV_CSP_SMS = 3590;
3255: public const GTRACK_SERVER = 3591;
3256: public const GTRACK_NE = 3592;
3257: public const BPMD = 3593;
3258: public const MEDIASPACE = 3594;
3259: public const SHAREAPP = 3595;
3260: public const IW_MMOGAME = 3596;
3261: public const A14 = 3597;
3262: public const A15 = 3598;
3263: public const QUASAR_SERVER = 3599;
3264: public const TRAP_DAEMON = 3600;
3265: public const VISINET_GUI = 3601;
3266: public const INFINISWITCHCL = 3602;
3267: public const INT_RCV_CNTRL = 3603;
3268: public const BMC_JMX_PORT = 3604;
3269: public const COMCAM_IO = 3605;
3270: public const SPLITLOCK = 3606;
3271: public const PRECISE_I3 = 3607;
3272: public const TRENDCHIP_DCP = 3608;
3273: public const CPDI_PIDAS_CM = 3609;
3274: public const ECHONET = 3610;
3275: public const SIX_DEGREES = 3611;
3276: public const HP_DATAPROTECT = 3612;
3277: public const ALARIS_DISC = 3613;
3278: public const SIGMA_PORT = 3614;
3279: public const START_NETWORK = 3615;
3280: public const CD3O_PROTOCOL = 3616;
3281: public const SHARP_SERVER = 3617;
3282: public const AAIRNET_1 = 3618;
3283: public const AAIRNET_2 = 3619;
3284: public const EP_PCP = 3620;
3285: public const EP_NSP = 3621;
3286: public const FF_LR_PORT = 3622;
3287: public const HAIPE_DISCOVER = 3623;
3288: public const DIST_UPGRADE = 3624;
3289: public const VOLLEY = 3625;
3290: public const BVCDAEMON_PORT = 3626;
3291: public const JAMSERVERPORT = 3627;
3292: public const EPT_MACHINE = 3628;
3293: public const ESCVPNET = 3629;
3294: public const CS_REMOTE_DB = 3630;
3295: public const CS_SERVICES = 3631;
3296: public const DISTCC = 3632;
3297: public const WACP = 3633;
3298: public const HLIBMGR = 3634;
3299: public const SDO = 3635;
3300: public const SERVISTAITSM = 3636;
3301: public const SCSERVP = 3637;
3302: public const EHP_BACKUP = 3638;
3303: public const XAP_HA = 3639;
3304: public const NETPLAY_PORT1 = 3640;
3305: public const NETPLAY_PORT2 = 3641;
3306: public const JUXML_PORT = 3642;
3307: public const AUDIOJUGGLER = 3643;
3308: public const SSOWATCH = 3644;
3309: public const CYC = 3645;
3310: public const XSS_SRV_PORT = 3646;
3311: public const SPLITLOCK_GW = 3647;
3312: public const FJCP = 3648;
3313: public const NMMP = 3649;
3314: public const PRISMIQ_PLUGIN = 3650;
3315: public const XRPC_REGISTRY = 3651;
3316: public const VXCRNBUPORT = 3652;
3317: public const TSP = 3653;
3318: public const VAPRTM = 3654;
3319: public const ABATEMGR = 3655;
3320: public const ABATJSS = 3656;
3321: public const IMMEDIANET_BCN = 3657;
3322: public const PS_AMS = 3658;
3323: public const APPLE_SASL = 3659;
3324: public const CAN_NDS_SSL = 3660;
3325: public const CAN_FERRET_SSL = 3661;
3326: public const PSERVER = 3662;
3327: public const DTP = 3663;
3328: public const UPS_ENGINE = 3664;
3329: public const ENT_ENGINE = 3665;
3330: public const ESERVER_PAP = 3666;
3331: public const INFOEXCH = 3667;
3332: public const DELL_RM_PORT = 3668;
3333: public const CASANSWMGMT = 3669;
3334: public const SMILE = 3670;
3335: public const EFCP = 3671;
3336: public const LISPWORKS_ORB = 3672;
3337: public const MEDIAVAULT_GUI = 3673;
3338: public const WININSTALL_IPC = 3674;
3339: public const CALLTRAX = 3675;
3340: public const VA_PACBASE = 3676;
3341: public const ROVERLOG = 3677;
3342: public const IPR_DGLT = 3678;
3343: public const ESCALE = 3679;
3344: public const NPDS_TRACKER = 3680;
3345: public const BTS_X73 = 3681;
3346: public const CAS_MAPI = 3682;
3347: public const BMC_EA = 3683;
3348: public const FAXSTFX_PORT = 3684;
3349: public const DSX_AGENT = 3685;
3350: public const TNMPV2 = 3686;
3351: public const SIMPLE_PUSH = 3687;
3352: public const SIMPLE_PUSH_S = 3688;
3353: public const DAAP = 3689;
3354: public const SVN = 3690;
3355: public const MAGAYA_NETWORK = 3691;
3356: public const INTELSYNC = 3692;
3357: public const EASL = 3693;
3358: public const BMC_DATA_COLL = 3695;
3359: public const TELNETCPCD = 3696;
3360: public const NW_LICENSE = 3697;
3361: public const SAGECTLPANEL = 3698;
3362: public const KPN_ICW = 3699;
3363: public const LRS_PAGING = 3700;
3364: public const NETCELERA = 3701;
3365: public const WS_DISCOVERY = 3702;
3366: public const ADOBESERVER_3 = 3703;
3367: public const ADOBESERVER_4 = 3704;
3368: public const ADOBESERVER_5 = 3705;
3369: public const RT_EVENT = 3706;
3370: public const RT_EVENT_S = 3707;
3371: public const SUN_AS_IIOPS = 3708;
3372: public const CA_IDMS = 3709;
3373: public const PORTGATE_AUTH = 3710;
3374: public const EDB_SERVER2 = 3711;
3375: public const SENTINEL_ENT = 3712;
3376: public const TFTPS = 3713;
3377: public const DELOS_DMS = 3714;
3378: public const ANOTO_RENDEZV = 3715;
3379: public const WV_CSP_SMS_CIR = 3716;
3380: public const WV_CSP_UDP_CIR = 3717;
3381: public const OPUS_SERVICES = 3718;
3382: public const ITELSERVERPORT = 3719;
3383: public const UFASTRO_INSTR = 3720;
3384: public const XSYNC = 3721;
3385: public const XSERVERAID = 3722;
3386: public const SYCHROND = 3723;
3387: public const BLIZWOW = 3724;
3388: public const NA_ER_TIP = 3725;
3389: public const ARRAY_MANAGER = 3726;
3390: public const E_MDU = 3727;
3391: public const E_WOA = 3728;
3392: public const FKSP_AUDIT = 3729;
3393: public const CLIENT_CTRL = 3730;
3394: public const SMAP = 3731;
3395: public const M_WNN = 3732;
3396: public const MULTIP_MSG = 3733;
3397: public const SYNEL_DATA = 3734;
3398: public const PWDIS = 3735;
3399: public const RS_RMI = 3736;
3400: public const XPANEL = 3737;
3401: public const VERSATALK = 3738;
3402: public const LAUNCHBIRD_LM = 3739;
3403: public const HEARTBEAT = 3740;
3404: public const WYSDMA = 3741;
3405: public const CST_PORT = 3742;
3406: public const IPCS_COMMAND = 3743;
3407: public const SASG = 3744;
3408: public const GW_CALL_PORT = 3745;
3409: public const LINKTEST = 3746;
3410: public const LINKTEST_S = 3747;
3411: public const WEBDATA = 3748;
3412: public const CIMTRAK = 3749;
3413: public const CBOS_IP_PORT = 3750;
3414: public const GPRS_CUBE = 3751;
3415: public const VIPREMOTEAGENT = 3752;
3416: public const NATTYSERVER = 3753;
3417: public const TIMESTENBROKER = 3754;
3418: public const SAS_REMOTE_HLP = 3755;
3419: public const CANON_CAPT = 3756;
3420: public const GRF_PORT = 3757;
3421: public const APW_REGISTRY = 3758;
3422: public const EXAPT_LMGR = 3759;
3423: public const ADTEMPUSCLIENT = 3760;
3424: public const GSAKMP = 3761;
3425: public const GBS_SMP = 3762;
3426: public const XO_WAVE = 3763;
3427: public const MNI_PROT_ROUT = 3764;
3428: public const RTRACEROUTE = 3765;
3429: public const SITEWATCH_S = 3766;
3430: public const LISTMGR_PORT = 3767;
3431: public const RBLCHECKD = 3768;
3432: public const HAIPE_OTNK = 3769;
3433: public const CINDYCOLLAB = 3770;
3434: public const PAGING_PORT = 3771;
3435: public const CTP = 3772;
3436: public const CTDHERCULES = 3773;
3437: public const ZICOM = 3774;
3438: public const ISPMMGR = 3775;
3439: public const DVCPROV_PORT = 3776;
3440: public const JIBE_EB = 3777;
3441: public const C_H_IT_PORT = 3778;
3442: public const COGNIMA = 3779;
3443: public const NNP = 3780;
3444: public const ABCVOICE_PORT = 3781;
3445: public const ISO_TP0S = 3782;
3446: public const BIM_PEM = 3783;
3447: public const BFD_CONTROL = 3784;
3448: public const BFD_ECHO = 3785;
3449: public const UPSTRIGGERVSW = 3786;
3450: public const FINTRX = 3787;
3451: public const ISRP_PORT = 3788;
3452: public const REMOTEDEPLOY = 3789;
3453: public const QUICKBOOKSRDS = 3790;
3454: public const TVNETWORKVIDEO = 3791;
3455: public const SITEWATCH = 3792;
3456: public const DCSOFTWARE = 3793;
3457: public const JAUS = 3794;
3458: public const MYBLAST = 3795;
3459: public const SPW_DIALER = 3796;
3460: public const IDPS = 3797;
3461: public const MINILOCK = 3798;
3462: public const RADIUS_DYNAUTH = 3799;
3463: public const PWGPSI = 3800;
3464: public const IBM_MGR = 3801;
3465: public const VHD = 3802;
3466: public const SONIQSYNC = 3803;
3467: public const IQNET_PORT = 3804;
3468: public const TCPDATASERVER = 3805;
3469: public const WSMLB = 3806;
3470: public const SPUGNA = 3807;
3471: public const SUN_AS_IIOPS_CA = 3808;
3472: public const APOCD = 3809;
3473: public const WLANAUTH = 3810;
3474: public const AMP = 3811;
3475: public const NETO_WOL_SERVER = 3812;
3476: public const RAP_IP = 3813;
3477: public const NETO_DCS = 3814;
3478: public const LANSURVEYORXML = 3815;
3479: public const SUNLPS_HTTP = 3816;
3480: public const TAPEWARE = 3817;
3481: public const CRINIS_HB = 3818;
3482: public const EPL_SLP = 3819;
3483: public const SCP = 3820;
3484: public const PMCP = 3821;
3485: public const ACP_DISCOVERY = 3822;
3486: public const ACP_CONDUIT = 3823;
3487: public const ACP_POLICY = 3824;
3488: public const FFSERVER = 3825;
3489: public const WARMUX = 3826;
3490: public const NETMPI = 3827;
3491: public const NETEH = 3828;
3492: public const NETEH_EXT = 3829;
3493: public const CERNSYSMGMTAGT = 3830;
3494: public const DVAPPS = 3831;
3495: public const XXNETSERVER = 3832;
3496: public const AIPN_AUTH = 3833;
3497: public const SPECTARDATA = 3834;
3498: public const SPECTARDB = 3835;
3499: public const MARKEM_DCP = 3836;
3500: public const MKM_DISCOVERY = 3837;
3501: public const SOS = 3838;
3502: public const AMX_RMS = 3839;
3503: public const FLIRTMITMIR = 3840;
3504: public const SHIPRUSH_DB_SVR = 3841;
3505: public const NHCI = 3842;
3506: public const QUEST_AGENT = 3843;
3507: public const RNM = 3844;
3508: public const V_ONE_SPP = 3845;
3509: public const AN_PCP = 3846;
3510: public const MSFW_CONTROL = 3847;
3511: public const ITEM = 3848;
3512: public const SPW_DNSPRELOAD = 3849;
3513: public const QTMS_BOOTSTRAP = 3850;
3514: public const SPECTRAPORT = 3851;
3515: public const SSE_APP_CONFIG = 3852;
3516: public const SSCAN = 3853;
3517: public const STRYKER_COM = 3854;
3518: public const OPENTRAC = 3855;
3519: public const INFORMER = 3856;
3520: public const TRAP_PORT = 3857;
3521: public const TRAP_PORT_MOM = 3858;
3522: public const NAV_PORT = 3859;
3523: public const SASP = 3860;
3524: public const WINSHADOW_HD = 3861;
3525: public const GIGA_POCKET = 3862;
3526: public const ASAP_TCP = 3863;
3527: public const ASAP_TCP_TLS = 3864;
3528: public const XPL = 3865;
3529: public const DZDAEMON = 3866;
3530: public const DZOGLSERVER = 3867;
3531: public const DIAMETER = 3868;
3532: public const OVSAM_MGMT = 3869;
3533: public const OVSAM_D_AGENT = 3870;
3534: public const AVOCENT_ADSAP = 3871;
3535: public const OEM_AGENT = 3872;
3536: public const FAGORDNC = 3873;
3537: public const SIXXSCONFIG = 3874;
3538: public const PNBSCADA = 3875;
3539: public const DL_AGENT = 3876;
3540: public const XMPCR_INTERFACE = 3877;
3541: public const FOTOGCAD = 3878;
3542: public const APPSS_LM = 3879;
3543: public const IGRS = 3880;
3544: public const IDAC = 3881;
3545: public const MSDTS1 = 3882;
3546: public const VRPN = 3883;
3547: public const SOFTRACK_METER = 3884;
3548: public const TOPFLOW_SSL = 3885;
3549: public const NEI_MANAGEMENT = 3886;
3550: public const CIPHIRE_DATA = 3887;
3551: public const CIPHIRE_SERV = 3888;
3552: public const DANDV_TESTER = 3889;
3553: public const NDSCONNECT = 3890;
3554: public const RTC_PM_PORT = 3891;
3555: public const PCC_IMAGE_PORT = 3892;
3556: public const CGI_STARAPI = 3893;
3557: public const SYAM_AGENT = 3894;
3558: public const SYAM_SMC = 3895;
3559: public const SDO_TLS = 3896;
3560: public const SDO_SSH = 3897;
3561: public const SENIP = 3898;
3562: public const ITV_CONTROL = 3899;
3563: public const UDT_OS_2 = 3900;
3564: public const NIMSH = 3901;
3565: public const NIMAUX = 3902;
3566: public const CHARSETMGR = 3903;
3567: public const OMNILINK_PORT = 3904;
3568: public const MUPDATE = 3905;
3569: public const TOPOVISTA_DATA = 3906;
3570: public const IMOGUIA_PORT = 3907;
3571: public const HPPRONETMAN = 3908;
3572: public const SURFCONTROLCPA = 3909;
3573: public const PRNREQUEST = 3910;
3574: public const PRNSTATUS = 3911;
3575: public const GBMT_STARS = 3912;
3576: public const LISTCRT_PORT = 3913;
3577: public const LISTCRT_PORT_2 = 3914;
3578: public const AGCAT = 3915;
3579: public const WYSDMC = 3916;
3580: public const AFTMUX = 3917;
3581: public const PKTCABLEMMCOPS = 3918;
3582: public const HYPERIP = 3919;
3583: public const EXASOFTPORT1 = 3920;
3584: public const HERODOTUS_NET = 3921;
3585: public const SOR_UPDATE = 3922;
3586: public const SYMB_SB_PORT = 3923;
3587: public const MPL_GPRS_PORT = 3924;
3588: public const ZMP = 3925;
3589: public const WINPORT = 3926;
3590: public const NATDATASERVICE = 3927;
3591: public const NETBOOT_PXE = 3928;
3592: public const SMAUTH_PORT = 3929;
3593: public const SYAM_WEBSERVER = 3930;
3594: public const MSR_PLUGIN_PORT = 3931;
3595: public const DYN_SITE = 3932;
3596: public const PLBSERVE_PORT = 3933;
3597: public const SUNFM_PORT = 3934;
3598: public const SDP_PORTMAPPER = 3935;
3599: public const MAILPROX = 3936;
3600: public const DVBSERVDSC = 3937;
3601: public const DBCONTROL_AGENT = 3938;
3602: public const AAMP = 3939;
3603: public const XECP_NODE = 3940;
3604: public const HOMEPORTAL_WEB = 3941;
3605: public const SRDP = 3942;
3606: public const TIG = 3943;
3607: public const SOPS = 3944;
3608: public const EMCADS = 3945;
3609: public const BACKUPEDGE = 3946;
3610: public const CCP = 3947;
3611: public const APDAP = 3948;
3612: public const DRIP = 3949;
3613: public const NAMEMUNGE = 3950;
3614: public const PWGIPPFAX = 3951;
3615: public const I3_SESSIONMGR = 3952;
3616: public const XMLINK_CONNECT = 3953;
3617: public const ADREP = 3954;
3618: public const P2PCOMMUNITY = 3955;
3619: public const GVCP = 3956;
3620: public const MQE_BROKER = 3957;
3621: public const MQE_AGENT = 3958;
3622: public const TREEHOPPER = 3959;
3623: public const BESS = 3960;
3624: public const PROAXESS = 3961;
3625: public const SBI_AGENT = 3962;
3626: public const THRP = 3963;
3627: public const SASGGPRS = 3964;
3628: public const ATI_IP_TO_NCPE = 3965;
3629: public const BFLCKMGR = 3966;
3630: public const PPSMS = 3967;
3631: public const IANYWHERE_DBNS = 3968;
3632: public const LANDMARKS = 3969;
3633: public const LANREVAGENT = 3970;
3634: public const LANREVSERVER = 3971;
3635: public const ICONP = 3972;
3636: public const PROGISTICS = 3973;
3637: public const CITYSEARCH = 3974;
3638: public const AIRSHOT = 3975;
3639: public const OPSWAGENT = 3976;
3640: public const OPSWMANAGER = 3977;
3641: public const SECURE_CFG_SVR = 3978;
3642: public const SMWAN = 3979;
3643: public const ACMS = 3980;
3644: public const STARFISH = 3981;
3645: public const EIS = 3982;
3646: public const EISP = 3983;
3647: public const MAPPER_NODEMGR = 3984;
3648: public const MAPPER_MAPETHD = 3985;
3649: public const MAPPER_WS_ETHD = 3986;
3650: public const CENTERLINE = 3987;
3651: public const DCS_CONFIG = 3988;
3652: public const BV_QUERYENGINE = 3989;
3653: public const BV_IS = 3990;
3654: public const BV_SMCSRV = 3991;
3655: public const BV_DS = 3992;
3656: public const BV_AGENT = 3993;
3657: public const ISS_MGMT_SSL = 3995;
3658: public const ABCSOFTWARE = 3996;
3659: public const AGENTSEASE_DB = 3997;
3660: public const DNX = 3998;
3661: public const NVCNET = 3999;
3662: public const TERABASE = 4000;
3663: public const NEWOAK = 4001;
3664: public const PXC_SPVR_FT = 4002;
3665: public const PXC_SPLR_FT = 4003;
3666: public const PXC_ROID = 4004;
3667: public const PXC_PIN = 4005;
3668: public const PXC_SPVR = 4006;
3669: public const PXC_SPLR = 4007;
3670: public const NETCHEQUE = 4008;
3671: public const CHIMERA_HWM = 4009;
3672: public const SAMSUNG_UNIDEX = 4010;
3673: public const ALTSERVICEBOOT = 4011;
3674: public const PDA_GATE = 4012;
3675: public const ACL_MANAGER = 4013;
3676: public const TAICLOCK = 4014;
3677: public const TALARIAN_MCAST1 = 4015;
3678: public const TALARIAN_MCAST2 = 4016;
3679: public const TALARIAN_MCAST3 = 4017;
3680: public const TALARIAN_MCAST4 = 4018;
3681: public const TALARIAN_MCAST5 = 4019;
3682: public const TRAP = 4020;
3683: public const NEXUS_PORTAL = 4021;
3684: public const DNOX = 4022;
3685: public const ESNM_ZONING = 4023;
3686: public const TNP1_PORT = 4024;
3687: public const PARTIMAGE = 4025;
3688: public const AS_DEBUG = 4026;
3689: public const BXP = 4027;
3690: public const DTSERVER_PORT = 4028;
3691: public const IP_QSIG = 4029;
3692: public const JDMN_PORT = 4030;
3693: public const SUUCP = 4031;
3694: public const VRTS_AUTH_PORT = 4032;
3695: public const SANAVIGATOR = 4033;
3696: public const UBXD = 4034;
3697: public const WAP_PUSH_HTTP = 4035;
3698: public const WAP_PUSH_HTTPS = 4036;
3699: public const RAVEHD = 4037;
3700: public const FAZZT_PTP = 4038;
3701: public const FAZZT_ADMIN = 4039;
3702: public const YO_MAIN = 4040;
3703: public const HOUSTON = 4041;
3704: public const LDXP = 4042;
3705: public const NIRP = 4043;
3706: public const LTP = 4044;
3707: public const NPP_2 = 4045;
3708: public const ACP_PROTO = 4046;
3709: public const CTP_STATE = 4047;
3710: public const WAFS = 4049;
3711: public const CISCO_WAFS = 4050;
3712: public const CPPDP = 4051;
3713: public const INTERACT = 4052;
3714: public const CCU_COMM_1 = 4053;
3715: public const CCU_COMM_2 = 4054;
3716: public const CCU_COMM_3 = 4055;
3717: public const LMS = 4056;
3718: public const WFM = 4057;
3719: public const KINGFISHER = 4058;
3720: public const DLMS_COSEM = 4059;
3721: public const DSMETER_IATC = 4060;
3722: public const ICE_LOCATION = 4061;
3723: public const ICE_SLOCATION = 4062;
3724: public const ICE_ROUTER = 4063;
3725: public const ICE_SROUTER = 4064;
3726: public const AVANTI_CDP = 4065;
3727: public const PMAS = 4066;
3728: public const IDP = 4067;
3729: public const IPFLTBCST = 4068;
3730: public const MINGER = 4069;
3731: public const TRIPE = 4070;
3732: public const AIBKUP = 4071;
3733: public const ZIETO_SOCK = 4072;
3734: public const IRAPP = 4073;
3735: public const CEQUINT_CITYID = 4074;
3736: public const PERIMLAN = 4075;
3737: public const SERAPH = 4076;
3738: public const CSSP = 4078;
3739: public const SANTOOLS = 4079;
3740: public const LORICA_IN = 4080;
3741: public const LORICA_IN_SEC = 4081;
3742: public const LORICA_OUT = 4082;
3743: public const LORICA_OUT_SEC = 4083;
3744: public const EZMESSAGESRV = 4085;
3745: public const APPLUSSERVICE = 4087;
3746: public const NPSP = 4088;
3747: public const OPENCORE = 4089;
3748: public const OMASGPORT = 4090;
3749: public const EWINSTALLER = 4091;
3750: public const EWDGS = 4092;
3751: public const PVXPLUSCS = 4093;
3752: public const SYSRQD = 4094;
3753: public const XTGUI = 4095;
3754: public const BRE = 4096;
3755: public const PATROLVIEW = 4097;
3756: public const DRMSFSD = 4098;
3757: public const DPCP = 4099;
3758: public const IGO_INCOGNITO = 4100;
3759: public const BRLP_0 = 4101;
3760: public const BRLP_1 = 4102;
3761: public const BRLP_2 = 4103;
3762: public const BRLP_3 = 4104;
3763: public const SHOFAR = 4105;
3764: public const SYNCHRONITE = 4106;
3765: public const J_AC = 4107;
3766: public const ACCEL = 4108;
3767: public const IZM = 4109;
3768: public const G2TAG = 4110;
3769: public const XGRID = 4111;
3770: public const APPLE_VPNS_RP = 4112;
3771: public const AIPN_REG = 4113;
3772: public const JOMAMQMONITOR = 4114;
3773: public const CDS = 4115;
3774: public const SMARTCARD_TLS = 4116;
3775: public const HILLRSERV = 4117;
3776: public const NETSCRIPT = 4118;
3777: public const ASSURIA_SLM = 4119;
3778: public const MINIREM = 4120;
3779: public const E_BUILDER = 4121;
3780: public const FPRAMS = 4122;
3781: public const Z_WAVE = 4123;
3782: public const TIGV2 = 4124;
3783: public const OPSVIEW_ENVOY = 4125;
3784: public const DDREPL = 4126;
3785: public const UNIKEYPRO = 4127;
3786: public const NUFW = 4128;
3787: public const NUAUTH = 4129;
3788: public const FRONET = 4130;
3789: public const STARS = 4131;
3790: public const NUTS_DEM = 4132;
3791: public const NUTS_BOOTP = 4133;
3792: public const NIFTY_HMI = 4134;
3793: public const CL_DB_ATTACH = 4135;
3794: public const CL_DB_REQUEST = 4136;
3795: public const CL_DB_REMOTE = 4137;
3796: public const NETTEST = 4138;
3797: public const THRTX = 4139;
3798: public const CEDROS_FDS = 4140;
3799: public const OIRTGSVC = 4141;
3800: public const OIDOCSVC = 4142;
3801: public const OIDSR = 4143;
3802: public const VVR_CONTROL = 4145;
3803: public const TGCCONNECT = 4146;
3804: public const VRXPSERVMAN = 4147;
3805: public const HHB_HANDHELD = 4148;
3806: public const AGSLB = 4149;
3807: public const POWERALERT_NSA = 4150;
3808: public const MENANDMICE_NOH = 4151;
3809: public const IDIG_MUX = 4152;
3810: public const MBL_BATTD = 4153;
3811: public const ATLINKS = 4154;
3812: public const BZR = 4155;
3813: public const STAT_RESULTS = 4156;
3814: public const STAT_SCANNER = 4157;
3815: public const STAT_CC = 4158;
3816: public const NSS = 4159;
3817: public const JINI_DISCOVERY = 4160;
3818: public const OMSCONTACT = 4161;
3819: public const OMSTOPOLOGY = 4162;
3820: public const SILVERPEAKPEER = 4163;
3821: public const SILVERPEAKCOMM = 4164;
3822: public const ALTCP = 4165;
3823: public const JOOST = 4166;
3824: public const DDGN = 4167;
3825: public const PSLICSER = 4168;
3826: public const IADT = 4169;
3827: public const D_CINEMA_CSP = 4170;
3828: public const ML_SVNET = 4171;
3829: public const PCOIP = 4172;
3830: public const SMCLUSTER = 4174;
3831: public const BCCP = 4175;
3832: public const TL_IPCPROXY = 4176;
3833: public const WELLO = 4177;
3834: public const STORMAN = 4178;
3835: public const MAXUMSP = 4179;
3836: public const HTTPX = 4180;
3837: public const MACBAK = 4181;
3838: public const PCPTCPSERVICE = 4182;
3839: public const CYBORGNET = 4183;
3840: public const UNIVERSE_SUITE = 4184;
3841: public const WCPP = 4185;
3842: public const BOXBACKUPSTORE = 4186;
3843: public const CSC_PROXY = 4187;
3844: public const VATATA = 4188;
3845: public const PCEP = 4189;
3846: public const SIEVE = 4190;
3847: public const AZETI = 4192;
3848: public const PVXPLUSIO = 4193;
3849: public const HCTL = 4197;
3850: public const EIMS_ADMIN = 4199;
3851: public const VRML_MULTI_USE = 4200; // 4200-4299
3852: public const CORELCCAM = 4300;
3853: public const D_DATA = 4301;
3854: public const D_DATA_CONTROL = 4302;
3855: public const SRCP = 4303;
3856: public const OWSERVER = 4304;
3857: public const BATMAN = 4305;
3858: public const PINGHGL = 4306;
3859: public const TRUECONF = 4307;
3860: public const COMPX_LOCKVIEW = 4308;
3861: public const DSERVER = 4309;
3862: public const MIRRTEX = 4310;
3863: public const P6SSMC = 4311;
3864: public const PSCL_MGT = 4312;
3865: public const PERRLA = 4313;
3866: public const CHOICEVIEW_AGT = 4314;
3867: public const CHOICEVIEW_CLT = 4316;
3868: public const FDT_RCATP = 4320;
3869: public const RWHOIS = 4321;
3870: public const TRIM_EVENT = 4322;
3871: public const TRIM_ICE = 4323;
3872: public const GEOGNOSISMAN = 4325;
3873: public const GEOGNOSIS = 4326;
3874: public const JAXER_WEB = 4327;
3875: public const JAXER_MANAGER = 4328;
3876: public const PUBLIQARE_SYNC = 4329;
3877: public const DEY_SAPI = 4330;
3878: public const KTICKETS_REST = 4331;
3879: public const AHSP = 4333;
3880: public const NETCONF_CH_SSH = 4334;
3881: public const NETCONF_CH_TLS = 4335;
3882: public const RESTCONF_CH_TLS = 4336;
3883: public const GAIA = 4340;
3884: public const LISP_DATA = 4341;
3885: public const LISP_CONS = 4342;
3886: public const UNICALL = 4343;
3887: public const VINAINSTALL = 4344;
3888: public const M4_NETWORK_AS = 4345;
3889: public const ELANLM = 4346;
3890: public const LANSURVEYOR = 4347;
3891: public const ITOSE = 4348;
3892: public const FSPORTMAP = 4349;
3893: public const NET_DEVICE = 4350;
3894: public const PLCY_NET_SVCS = 4351;
3895: public const PJLINK = 4352;
3896: public const F5_IQUERY = 4353;
3897: public const QSNET_TRANS = 4354;
3898: public const QSNET_WORKST = 4355;
3899: public const QSNET_ASSIST = 4356;
3900: public const QSNET_COND = 4357;
3901: public const QSNET_NUCL = 4358;
3902: public const OMABCASTLTKM = 4359;
3903: public const MATRIX_VNET = 4360;
3904: public const WXBRIEF = 4368;
3905: public const EPMD = 4369;
3906: public const ELPRO_TUNNEL = 4370;
3907: public const L2C_CONTROL = 4371;
3908: public const L2C_DATA = 4372;
3909: public const REMCTL = 4373;
3910: public const PSI_PTT = 4374;
3911: public const TOLTECES = 4375;
3912: public const BIP = 4376;
3913: public const CP_SPXSVR = 4377;
3914: public const CP_SPXDPY = 4378;
3915: public const CTDB = 4379;
3916: public const XANDROS_CMS = 4389;
3917: public const WIEGAND = 4390;
3918: public const APWI_IMSERVER = 4391;
3919: public const APWI_RXSERVER = 4392;
3920: public const APWI_RXSPOOLER = 4393;
3921: public const OMNIVISIONESX = 4395;
3922: public const FLY = 4396;
3923: public const DS_SRV = 4400;
3924: public const DS_SRVR = 4401;
3925: public const DS_CLNT = 4402;
3926: public const DS_USER = 4403;
3927: public const DS_ADMIN = 4404;
3928: public const DS_MAIL = 4405;
3929: public const DS_SLP = 4406;
3930: public const NACAGENT = 4407;
3931: public const SLSCC = 4408;
3932: public const NETCABINET_COM = 4409;
3933: public const ITWO_SERVER = 4410;
3934: public const FOUND = 4411;
3935: public const AVI_NMS = 4413;
3936: public const UPDOG = 4414;
3937: public const BRCD_VR_REQ = 4415;
3938: public const PJJ_PLAYER = 4416;
3939: public const WORKFLOWDIR = 4417;
3940: public const CBP = 4419;
3941: public const NVM_EXPRESS = 4420;
3942: public const SCALEFT = 4421;
3943: public const TSEPISP = 4422;
3944: public const THINGKIT = 4423;
3945: public const NETROCKEY6 = 4425;
3946: public const BEACON_PORT_2 = 4426;
3947: public const DRIZZLE = 4427;
3948: public const OMVISERVER = 4428;
3949: public const OMVIAGENT = 4429;
3950: public const RSQLSERVER = 4430;
3951: public const WSPIPE = 4431;
3952: public const L_ACOUSTICS = 4432;
3953: public const VOP = 4433;
3954: public const SARIS = 4442;
3955: public const PHAROS = 4443;
3956: public const KRB524 = 4444;
3957: public const NV_VIDEO = 4444;
3958: public const UPNOTIFYP = 4445;
3959: public const N1_FWP = 4446;
3960: public const N1_RMGMT = 4447;
3961: public const ASC_SLMD = 4448;
3962: public const PRIVATEWIRE = 4449;
3963: public const CAMP = 4450;
3964: public const CTISYSTEMMSG = 4451;
3965: public const CTIPROGRAMLOAD = 4452;
3966: public const NSSALERTMGR = 4453;
3967: public const NSSAGENTMGR = 4454;
3968: public const PRCHAT_USER = 4455;
3969: public const PRCHAT_SERVER = 4456;
3970: public const PRREGISTER = 4457;
3971: public const MCP = 4458;
3972: public const HPSSMGMT = 4484;
3973: public const ASSYST_DR = 4485;
3974: public const ICMS = 4486;
3975: public const PREX_TCP = 4487;
3976: public const AWACS_ICE = 4488;
3977: public const IPSEC_NAT_T = 4500;
3978: public const EHS = 4535;
3979: public const EHS_SSL = 4536;
3980: public const WSSAUTHSVC = 4537;
3981: public const SWX_GATE = 4538;
3982: public const WORLDSCORES = 4545;
3983: public const SF_LM = 4546;
3984: public const LANNER_LM = 4547;
3985: public const SYNCHROMESH = 4548;
3986: public const AEGATE = 4549;
3987: public const GDS_ADPPIW_DB = 4550;
3988: public const IEEE_MIH = 4551;
3989: public const MENANDMICE_MON = 4552;
3990: public const ICSHOSTSVC = 4553;
3991: public const MSFRS = 4554;
3992: public const RSIP = 4555;
3993: public const DTN_BUNDLE = 4556;
3994: public const HYLAFAX = 4559;
3995: public const AMAHI_ANYWHERE = 4563;
3996: public const KWTC = 4566;
3997: public const TRAM = 4567;
3998: public const BMC_REPORTING = 4568;
3999: public const IAX = 4569;
4000: public const DEPLOYMENTMAP = 4570;
4001: public const CARDIFFTEC_BACK = 4573;
4002: public const RID = 4590;
4003: public const L3T_AT_AN = 4591;
4004: public const IPT_ANRI_ANRI = 4593;
4005: public const IAS_SESSION = 4594;
4006: public const IAS_PAGING = 4595;
4007: public const IAS_NEIGHBOR = 4596;
4008: public const A21_AN_1XBS = 4597;
4009: public const A16_AN_AN = 4598;
4010: public const A17_AN_AN = 4599;
4011: public const PIRANHA1 = 4600;
4012: public const PIRANHA2 = 4601;
4013: public const MTSSERVER = 4602;
4014: public const MENANDMICE_UPG = 4603;
4015: public const IRP = 4604;
4016: public const SIXCHAT = 4605;
4017: public const PLAYSTA2_APP = 4658;
4018: public const PLAYSTA2_LOB = 4659;
4019: public const SMACLMGR = 4660;
4020: public const KAR2OUCHE = 4661;
4021: public const OMS = 4662;
4022: public const NOTEIT = 4663;
4023: public const EMS = 4664;
4024: public const CONTCLIENTMS = 4665;
4025: public const EPORTCOMM = 4666;
4026: public const MMACOMM = 4667;
4027: public const MMAEDS = 4668;
4028: public const EPORTCOMMDATA = 4669;
4029: public const LIGHT = 4670;
4030: public const ACTER = 4671;
4031: public const RFA = 4672;
4032: public const CXWS = 4673;
4033: public const APPIQ_MGMT = 4674;
4034: public const DHCT_STATUS = 4675;
4035: public const DHCT_ALERTS = 4676;
4036: public const BCS = 4677;
4037: public const TRAVERSAL = 4678;
4038: public const MGESUPERVISION = 4679;
4039: public const MGEMANAGEMENT = 4680;
4040: public const PARLIANT = 4681;
4041: public const FINISAR = 4682;
4042: public const SPIKE = 4683;
4043: public const RFID_RP1 = 4684;
4044: public const AUTOPAC = 4685;
4045: public const MSP_OS = 4686;
4046: public const NST = 4687;
4047: public const MOBILE_P2P = 4688;
4048: public const ALTOVACENTRAL = 4689;
4049: public const PRELUDE = 4690;
4050: public const MTN = 4691;
4051: public const CONSPIRACY = 4692;
4052: public const NETXMS_AGENT = 4700;
4053: public const NETXMS_MGMT = 4701;
4054: public const NETXMS_SYNC = 4702;
4055: public const NPQES_TEST = 4703;
4056: public const ASSURIA_INS = 4704;
4057: public const TRINITY_DIST = 4711;
4058: public const TRUCKSTAR = 4725;
4059: public const FCIS = 4727;
4060: public const CAPMUX = 4728;
4061: public const GEARMAN = 4730;
4062: public const REMCAP = 4731;
4063: public const RESORCS = 4733;
4064: public const IPDR_SP = 4737;
4065: public const SOLERA_LPN = 4738;
4066: public const IPFIX = 4739;
4067: public const IPFIXS = 4740;
4068: public const LUMIMGRD = 4741;
4069: public const SICCT = 4742;
4070: public const OPENHPID = 4743;
4071: public const IFSP = 4744;
4072: public const FMP = 4745;
4073: public const PROFILEMAC = 4749;
4074: public const SSAD = 4750;
4075: public const SPOCP = 4751;
4076: public const SNAP = 4752;
4077: public const SIMON = 4753;
4078: public const RDCENTER = 4756;
4079: public const CONVERGE = 4774;
4080: public const BFD_MULTI_CTL = 4784;
4081: public const SMART_INSTALL = 4786;
4082: public const SIA_CTRL_PLANE = 4787;
4083: public const XMCP = 4788;
4084: public const IIMS = 4800;
4085: public const IWEC = 4801;
4086: public const ILSS = 4802;
4087: public const NOTATEIT = 4803;
4088: public const HTCP = 4827;
4089: public const VARADERO_0 = 4837;
4090: public const VARADERO_1 = 4838;
4091: public const VARADERO_2 = 4839;
4092: public const OPCUA_TCP = 4840;
4093: public const QUOSA = 4841;
4094: public const GW_ASV = 4842;
4095: public const OPCUA_TLS = 4843;
4096: public const GW_LOG = 4844;
4097: public const WCR_REMLIB = 4845;
4098: public const CONTAMAC_ICM = 4846;
4099: public const WFC = 4847;
4100: public const APPSERV_HTTP = 4848;
4101: public const APPSERV_HTTPS = 4849;
4102: public const SUN_AS_NODEAGT = 4850;
4103: public const DERBY_REPLI = 4851;
4104: public const UNIFY_DEBUG = 4867;
4105: public const PHRELAY = 4868;
4106: public const PHRELAYDBG = 4869;
4107: public const CC_TRACKING = 4870;
4108: public const WIRED = 4871;
4109: public const TRITIUM_CAN = 4876;
4110: public const LMCS = 4877;
4111: public const WSDL_EVENT = 4879;
4112: public const HISLIP = 4880;
4113: public const WMLSERVER = 4883;
4114: public const HIVESTOR = 4884;
4115: public const ABBS = 4885;
4116: public const LYSKOM = 4894;
4117: public const RADMIN_PORT = 4899;
4118: public const HFCS = 4900;
4119: public const FLR_AGENT = 4901;
4120: public const MAGICCONTROL = 4902;
4121: public const LUTAP = 4912;
4122: public const LUTCP = 4913;
4123: public const BONES = 4914;
4124: public const FRCS = 4915;
4125: public const EQ_OFFICE_4940 = 4940;
4126: public const EQ_OFFICE_4941 = 4941;
4127: public const EQ_OFFICE_4942 = 4942;
4128: public const MUNIN = 4949;
4129: public const SYBASESRVMON = 4950;
4130: public const PWGWIMS = 4951;
4131: public const SAGXTSDS = 4952;
4132: public const DBSYNCARBITER = 4953;
4133: public const CCSS_QMM = 4969;
4134: public const CCSS_QSM = 4970;
4135: public const BURP = 4971;
4136: public const WEBYAST = 4984;
4137: public const GERHCS = 4985;
4138: public const MRIP = 4986;
4139: public const SMAR_SE_PORT1 = 4987;
4140: public const SMAR_SE_PORT2 = 4988;
4141: public const PARALLEL = 4989;
4142: public const BUSYCAL = 4990;
4143: public const VRT = 4991;
4144: public const HFCS_MANAGER = 4999;
4145: public const COMMPLEX_MAIN = 5000;
4146: public const COMMPLEX_LINK = 5001;
4147: public const RFE = 5002;
4148: public const FMPRO_INTERNAL = 5003;
4149: public const AVT_PROFILE_1 = 5004;
4150: public const AVT_PROFILE_2 = 5005;
4151: public const WSM_SERVER = 5006;
4152: public const WSM_SERVER_SSL = 5007;
4153: public const SYNAPSIS_EDGE = 5008;
4154: public const WINFS = 5009;
4155: public const TELELPATHSTART = 5010;
4156: public const TELELPATHATTACK = 5011;
4157: public const NSP = 5012;
4158: public const FMPRO_V6 = 5013;
4159: public const FMWP = 5015;
4160: public const ZENGINKYO_1 = 5020;
4161: public const ZENGINKYO_2 = 5021;
4162: public const MICE = 5022;
4163: public const HTUILSRV = 5023;
4164: public const SCPI_TELNET = 5024;
4165: public const SCPI_RAW = 5025;
4166: public const STREXEC_D = 5026;
4167: public const STREXEC_S = 5027;
4168: public const QVR = 5028;
4169: public const INFOBRIGHT = 5029;
4170: public const SURFPASS = 5030;
4171: public const SIGNACERT_AGENT = 5032;
4172: public const JTNETD_SERVER = 5033;
4173: public const JTNETD_STATUS = 5034;
4174: public const ASNAACCELER8DB = 5042;
4175: public const SWXADMIN = 5043;
4176: public const LXI_EVNTSVC = 5044;
4177: public const OSP = 5045;
4178: public const TEXAI = 5048;
4179: public const IVOCALIZE = 5049;
4180: public const MMCC = 5050;
4181: public const ITA_AGENT = 5051;
4182: public const ITA_MANAGER = 5052;
4183: public const RLM = 5053;
4184: public const RLM_ADMIN = 5054;
4185: public const UNOT = 5055;
4186: public const INTECOM_PS1 = 5056;
4187: public const INTECOM_PS2 = 5057;
4188: public const SDS = 5059;
4189: public const SIP = 5060;
4190: public const SIPS = 5061;
4191: public const NA_LOCALISE = 5062;
4192: public const CSRPC = 5063;
4193: public const CA_1 = 5064;
4194: public const CA_2 = 5065;
4195: public const STANAG_5066 = 5066;
4196: public const AUTHENTX = 5067;
4197: public const BITFORESTSRV = 5068;
4198: public const I_NET_2000_NPR = 5069;
4199: public const VTSAS = 5070;
4200: public const POWERSCHOOL = 5071;
4201: public const AYIYA = 5072;
4202: public const TAG_PM = 5073;
4203: public const ALESQUERY = 5074;
4204: public const PVACCESS = 5075;
4205: public const ONSCREEN = 5080;
4206: public const SDL_ETS = 5081;
4207: public const QCP = 5082;
4208: public const QFP = 5083;
4209: public const LLRP = 5084;
4210: public const ENCRYPTED_LLRP = 5085;
4211: public const APRIGO_CS = 5086;
4212: public const BIOTIC = 5087;
4213: public const SENTINEL_LM = 5093;
4214: public const HART_IP = 5094;
4215: public const SENTLM_SRV2SRV = 5099;
4216: public const SOCALIA = 5100;
4217: public const TALARIAN_TCP = 5101;
4218: public const OMS_NONSECURE = 5102;
4219: public const ACTIFIO_C2C = 5103;
4220: public const ACTIFIOUDSAGENT = 5106;
4221: public const ACTIFIOREPLIC = 5107;
4222: public const TAEP_AS_SVC = 5111;
4223: public const PM_CMDSVR = 5112;
4224: public const EV_SERVICES = 5114;
4225: public const AUTOBUILD = 5115;
4226: public const GRADECAM = 5117;
4227: public const BARRACUDA_BBS = 5120;
4228: public const NBT_PC = 5133;
4229: public const PPACTIVATION = 5134;
4230: public const ERP_SCALE = 5135;
4231: public const CTSD = 5137;
4232: public const RMONITOR_SECURE = 5145;
4233: public const SOCIAL_ALARM = 5146;
4234: public const ATMP = 5150;
4235: public const ESRI_SDE = 5151;
4236: public const SDE_DISCOVERY = 5152;
4237: public const TORUXSERVER = 5153;
4238: public const BZFLAG = 5154;
4239: public const ASCTRL_AGENT = 5155;
4240: public const RUGAMEONLINE = 5156;
4241: public const MEDIAT = 5157;
4242: public const SNMPSSH = 5161;
4243: public const SNMPSSH_TRAP = 5162;
4244: public const SBACKUP = 5163;
4245: public const VPA = 5164;
4246: public const IFE_ICORP = 5165;
4247: public const WINPCS = 5166;
4248: public const SCTE104 = 5167;
4249: public const SCTE30 = 5168;
4250: public const PCOIP_MGMT = 5172;
4251: public const AOL = 5190;
4252: public const AOL_1 = 5191;
4253: public const AOL_2 = 5192;
4254: public const AOL_3 = 5193;
4255: public const CPSCOMM = 5194;
4256: public const AMPL_LIC = 5195;
4257: public const AMPL_TABLEPROXY = 5196;
4258: public const TUNSTALL_LWP = 5197;
4259: public const TARGUS_GETDATA = 5200;
4260: public const TARGUS_GETDATA1 = 5201;
4261: public const TARGUS_GETDATA2 = 5202;
4262: public const TARGUS_GETDATA3 = 5203;
4263: public const NOMAD = 5209;
4264: public const NOTEZA = 5215;
4265: public const _3EXMP = 5221;
4266: public const XMPP_CLIENT = 5222;
4267: public const HPVIRTGRP = 5223;
4268: public const HPVIRTCTRL = 5224;
4269: public const HP_SERVER = 5225;
4270: public const HP_STATUS = 5226;
4271: public const PERFD = 5227;
4272: public const HPVROOM = 5228;
4273: public const JAXFLOW = 5229;
4274: public const JAXFLOW_DATA = 5230;
4275: public const CRUSECONTROL = 5231;
4276: public const CSEDAEMON = 5232;
4277: public const ENFS = 5233;
4278: public const EENET = 5234;
4279: public const GALAXY_NETWORK = 5235;
4280: public const PADL2SIM = 5236;
4281: public const MNET_DISCOVERY = 5237;
4282: public const DOWNTOOLS = 5245;
4283: public const CAACWS = 5248;
4284: public const CAACLANG2 = 5249;
4285: public const SOAGATEWAY = 5250;
4286: public const CAEVMS = 5251;
4287: public const MOVAZ_SSC = 5252;
4288: public const KPDP = 5253;
4289: public const LOGCABIN = 5254;
4290: public const _3COM_NJACK_1 = 5264;
4291: public const _3COM_NJACK_2 = 5265;
4292: public const XMPP_SERVER = 5269;
4293: public const CARTOGRAPHERXMP = 5270;
4294: public const CUELINK = 5271;
4295: public const PK = 5272;
4296: public const XMPP_BOSH = 5280;
4297: public const UNDO_LM = 5281;
4298: public const TRANSMIT_PORT = 5282;
4299: public const PRESENCE = 5298;
4300: public const NLG_DATA = 5299;
4301: public const HACL_HB = 5300;
4302: public const HACL_GS = 5301;
4303: public const HACL_CFG = 5302;
4304: public const HACL_PROBE = 5303;
4305: public const HACL_LOCAL = 5304;
4306: public const HACL_TEST = 5305;
4307: public const SUN_MC_GRP = 5306;
4308: public const SCO_AIP = 5307;
4309: public const CFENGINE = 5308;
4310: public const JPRINTER = 5309;
4311: public const OUTLAWS = 5310;
4312: public const PERMABIT_CS = 5312;
4313: public const RRDP = 5313;
4314: public const OPALIS_RBT_IPC = 5314;
4315: public const HACL_POLL = 5315;
4316: public const HPBLADEMS = 5316;
4317: public const HPDEVMS = 5317;
4318: public const PKIX_CMC = 5318;
4319: public const BSFSERVER_ZN = 5320;
4320: public const BSFSVR_ZN_SSL = 5321;
4321: public const KFSERVER = 5343;
4322: public const XKOTODRCP = 5344;
4323: public const STUNS = 5349;
4324: public const TURNS = 5349;
4325: public const STUN_BEHAVIORS = 5349;
4326: public const DNS_LLQ = 5352;
4327: public const MDNS = 5353;
4328: public const MDNSRESPONDER = 5354;
4329: public const LLMNR = 5355;
4330: public const MS_SMLBIZ = 5356;
4331: public const WSDAPI = 5357;
4332: public const WSDAPI_S = 5358;
4333: public const MS_ALERTER = 5359;
4334: public const MS_SIDESHOW = 5360;
4335: public const MS_S_SIDESHOW = 5361;
4336: public const SERVERWSD2 = 5362;
4337: public const NET_PROJECTION = 5363;
4338: public const STRESSTESTER = 5397;
4339: public const ELEKTRON_ADMIN = 5398;
4340: public const SECURITYCHASE = 5399;
4341: public const EXCERPT = 5400;
4342: public const EXCERPTS = 5401;
4343: public const _MFTP = 5402;
4344: public const HPOMS_CI_LSTN = 5403;
4345: public const HPOMS_DPS_LSTN = 5404;
4346: public const NETSUPPORT = 5405;
4347: public const SYSTEMICS_SOX = 5406;
4348: public const FORESYTE_CLEAR = 5407;
4349: public const FORESYTE_SEC = 5408;
4350: public const SALIENT_DTASRV = 5409;
4351: public const SALIENT_USRMGR = 5410;
4352: public const ACTNET = 5411;
4353: public const CONTINUUS = 5412;
4354: public const WWIOTALK = 5413;
4355: public const STATUSD = 5414;
4356: public const NS_SERVER = 5415;
4357: public const SNS_GATEWAY = 5416;
4358: public const SNS_AGENT = 5417;
4359: public const MCNTP = 5418;
4360: public const DJ_ICE = 5419;
4361: public const CYLINK_C = 5420;
4362: public const NETSUPPORT2 = 5421;
4363: public const SALIENT_MUX = 5422;
4364: public const VIRTUALUSER = 5423;
4365: public const BEYOND_REMOTE = 5424;
4366: public const BR_CHANNEL = 5425;
4367: public const DEVBASIC = 5426;
4368: public const SCO_PEER_TTA = 5427;
4369: public const TELACONSOLE = 5428;
4370: public const BASE = 5429;
4371: public const RADEC_CORP = 5430;
4372: public const PARK_AGENT = 5431;
4373: public const POSTGRESQL = 5432;
4374: public const PYRRHO = 5433;
4375: public const SGI_ARRAYD = 5434;
4376: public const SCEANICS = 5435;
4377: public const SPSS = 5443;
4378: public const SMBDIRECT = 5445;
4379: public const TIEPIE = 5450;
4380: public const SUREBOX = 5453;
4381: public const APC_5454 = 5454;
4382: public const APC_5455 = 5455;
4383: public const APC_5456 = 5456;
4384: public const SILKMETER = 5461;
4385: public const TTL_PUBLISHER = 5462;
4386: public const TTLPRICEPROXY = 5463;
4387: public const QUAILNET = 5464;
4388: public const NETOPS_BROKER = 5465;
4389: public const APSOLAB_COL = 5470;
4390: public const APSOLAB_COLS = 5471;
4391: public const APSOLAB_TAG = 5472;
4392: public const APSOLAB_TAGS = 5473;
4393: public const APSOLAB_DATA = 5475;
4394: public const FCP_ADDR_SRVR1 = 5500;
4395: public const FCP_ADDR_SRVR2 = 5501;
4396: public const FCP_SRVR_INST1 = 5502;
4397: public const FCP_SRVR_INST2 = 5503;
4398: public const FCP_CICS_GW1 = 5504;
4399: public const CHECKOUTDB = 5505;
4400: public const AMC = 5506;
4401: public const PSL_MANAGEMENT = 5507;
4402: public const CBUS = 5550;
4403: public const SGI_EVENTMOND = 5553;
4404: public const SGI_ESPHTTP = 5554;
4405: public const PERSONAL_AGENT = 5555;
4406: public const FREECIV = 5556;
4407: public const FARENET = 5557;
4408: public const HPE_DP_BURA = 5565;
4409: public const WESTEC_CONNECT = 5566;
4410: public const DOF_DPS_MC_SEC = 5567;
4411: public const SDT = 5568;
4412: public const RDMNET_CTRL = 5569;
4413: public const SDMMP = 5573;
4414: public const LSI_BOBCAT = 5574;
4415: public const ORA_OAP = 5575;
4416: public const FDTRACKS = 5579;
4417: public const TMOSMS0 = 5580;
4418: public const TMOSMS1 = 5581;
4419: public const FAC_RESTORE = 5582;
4420: public const TMO_ICON_SYNC = 5583;
4421: public const BIS_WEB = 5584;
4422: public const BIS_SYNC = 5585;
4423: public const ATT_MT_SMS = 5586;
4424: public const ININMESSAGING = 5597;
4425: public const MCTFEED = 5598;
4426: public const ESINSTALL = 5599;
4427: public const ESMMANAGER = 5600;
4428: public const ESMAGENT = 5601;
4429: public const A1_MSC = 5602;
4430: public const A1_BS = 5603;
4431: public const A3_SDUNODE = 5604;
4432: public const A4_SDUNODE = 5605;
4433: public const EFR = 5618;
4434: public const NINAF = 5627;
4435: public const HTRUST = 5628;
4436: public const SYMANTEC_SFDB = 5629;
4437: public const PRECISE_COMM = 5630;
4438: public const PCANYWHEREDATA = 5631;
4439: public const PCANYWHERESTAT = 5632;
4440: public const BEORL = 5633;
4441: public const XPRTLD = 5634;
4442: public const SFMSSO = 5635;
4443: public const SFM_DB_SERVER = 5636;
4444: public const CSSC = 5637;
4445: public const FLCRS = 5638;
4446: public const ICS = 5639;
4447: public const VFMOBILE = 5646;
4448: public const NRPE = 5666;
4449: public const FILEMQ = 5670;
4450: public const AMQPS = 5671;
4451: public const AMQP = 5672;
4452: public const JMS = 5673;
4453: public const HYPERSCSI_PORT = 5674;
4454: public const V5UA = 5675;
4455: public const RAADMIN = 5676;
4456: public const QUESTDB2_LNCHR = 5677;
4457: public const RRAC = 5678;
4458: public const DCCM = 5679;
4459: public const AURIGA_ROUTER = 5680;
4460: public const NCXCP = 5681;
4461: public const COAP = 5683;
4462: public const COAPS = 5684;
4463: public const GGZ = 5688;
4464: public const QMVIDEO = 5689;
4465: public const RBSYSTEM = 5693;
4466: public const KMIP = 5696;
4467: public const SUPPORTASSIST = 5700;
4468: public const STORAGEOS = 5705;
4469: public const PROSHAREAUDIO = 5713;
4470: public const PROSHAREVIDEO = 5714;
4471: public const PROSHAREDATA = 5715;
4472: public const PROSHAREREQUEST = 5716;
4473: public const PROSHARENOTIFY = 5717;
4474: public const DPM = 5718;
4475: public const DPM_AGENT = 5719;
4476: public const MS_LICENSING = 5720;
4477: public const DTPT = 5721;
4478: public const MSDFSR = 5722;
4479: public const OMHS = 5723;
4480: public const OMSDK = 5724;
4481: public const MS_ILM = 5725;
4482: public const MS_ILM_STS = 5726;
4483: public const ASGENF = 5727;
4484: public const IO_DIST_DATA = 5728;
4485: public const OPENMAIL = 5729;
4486: public const UNIENG = 5730;
4487: public const IDA_DISCOVER1 = 5741;
4488: public const IDA_DISCOVER2 = 5742;
4489: public const WATCHDOC_POD = 5743;
4490: public const WATCHDOC = 5744;
4491: public const FCOPY_SERVER = 5745;
4492: public const FCOPYS_SERVER = 5746;
4493: public const TUNATIC = 5747;
4494: public const TUNALYZER = 5748;
4495: public const RSCD = 5750;
4496: public const OPENMAILG = 5755;
4497: public const X500MS = 5757;
4498: public const OPENMAILNS = 5766;
4499: public const S_OPENMAIL = 5767;
4500: public const OPENMAILPXY = 5768;
4501: public const SPRAMSCA = 5769;
4502: public const SPRAMSD = 5770;
4503: public const NETAGENT = 5771;
4504: public const DALI_PORT = 5777;
4505: public const VTS_RPC = 5780;
4506: public const _3PAR_EVTS = 5781;
4507: public const _3PAR_MGMT = 5782;
4508: public const _3PAR_MGMT_SSL = 5783;
4509: public const _3PAR_RCOPY = 5785;
4510: public const XTREAMX = 5793;
4511: public const ICMPD = 5813;
4512: public const SPT_AUTOMATION = 5814;
4513: public const SHIPRUSH_D_CH = 5841;
4514: public const REVERSION = 5842;
4515: public const WHEREHOO = 5859;
4516: public const PPSUITEMSG = 5863;
4517: public const DIAMETERS = 5868;
4518: public const JUTE = 5883;
4519: public const RFB = 5900;
4520: public const CM = 5910;
4521: public const CPDLC = 5911;
4522: public const FIS = 5912;
4523: public const ADS_C = 5913;
4524: public const INDY = 5963;
4525: public const MPPOLICY_V5 = 5968;
4526: public const MPPOLICY_MGR = 5969;
4527: public const COUCHDB = 5984;
4528: public const WSMAN = 5985;
4529: public const WSMANS = 5986;
4530: public const WBEM_RMI = 5987;
4531: public const WBEM_HTTP = 5988;
4532: public const WBEM_HTTPS = 5989;
4533: public const WBEM_EXP_HTTPS = 5990;
4534: public const NUXSL = 5991;
4535: public const CONSUL_INSIGHT = 5992;
4536: public const CIM_RS = 5993;
4537: public const CVSUP = 5999;
4538: public const X11 = 6000; // 6000-6063
4539: public const NDL_AHP_SVC = 6064;
4540: public const WINPHARAOH = 6065;
4541: public const EWCTSP = 6066;
4542: public const GSMP_ANCP = 6068;
4543: public const TRIP = 6069;
4544: public const MESSAGEASAP = 6070;
4545: public const SSDTP = 6071;
4546: public const DIAGNOSE_PROC = 6072;
4547: public const DIRECTPLAY8 = 6073;
4548: public const MAX = 6074;
4549: public const DPM_ACM = 6075;
4550: public const MSFT_DPM_CERT = 6076;
4551: public const ICONSTRUCTSRV = 6077;
4552: public const RELOAD_CONFIG = 6084;
4553: public const KONSPIRE2B = 6085;
4554: public const PDTP = 6086;
4555: public const LDSS = 6087;
4556: public const DOGLMS = 6088;
4557: public const RAXA_MGMT = 6099;
4558: public const SYNCHRONET_DB = 6100;
4559: public const SYNCHRONET_RTC = 6101;
4560: public const SYNCHRONET_UPD = 6102;
4561: public const RETS = 6103;
4562: public const DBDB = 6104;
4563: public const PRIMASERVER = 6105;
4564: public const MPSSERVER = 6106;
4565: public const ETC_CONTROL = 6107;
4566: public const SERCOMM_SCADMIN = 6108;
4567: public const GLOBECAST_ID = 6109;
4568: public const SOFTCM = 6110;
4569: public const SPC = 6111;
4570: public const DTSPCD = 6112;
4571: public const DAYLITESERVER = 6113;
4572: public const WRSPICE = 6114;
4573: public const XIC = 6115;
4574: public const XTLSERV = 6116;
4575: public const DAYLITETOUCH = 6117;
4576: public const SPDY = 6121;
4577: public const BEX_WEBADMIN = 6122;
4578: public const BACKUP_EXPRESS = 6123;
4579: public const PNBS = 6124;
4580: public const DAMEWAREMOBGTWY = 6130;
4581: public const NBT_WOL = 6133;
4582: public const PULSONIXNLS = 6140;
4583: public const META_CORP = 6141;
4584: public const ASPENTEC_LM = 6142;
4585: public const WATERSHED_LM = 6143;
4586: public const STATSCI1_LM = 6144;
4587: public const STATSCI2_LM = 6145;
4588: public const LONEWOLF_LM = 6146;
4589: public const MONTAGE_LM = 6147;
4590: public const RICARDO_LM_2 = 6148;
4591: public const TAL_POD = 6149;
4592: public const EFB_ACI = 6159;
4593: public const ECMP = 6160;
4594: public const PATROL_ISM = 6161;
4595: public const PATROL_COLL = 6162;
4596: public const PSCRIBE = 6163;
4597: public const LM_X = 6200;
4598: public const QMTPS = 6209;
4599: public const RADMIND = 6222;
4600: public const JEOL_NSDTP_1 = 6241;
4601: public const JEOL_NSDTP_2 = 6242;
4602: public const JEOL_NSDTP_3 = 6243;
4603: public const JEOL_NSDTP_4 = 6244;
4604: public const TL1_RAW_SSL = 6251;
4605: public const TL1_SSH = 6252;
4606: public const CRIP = 6253;
4607: public const GLD = 6267;
4608: public const GRID = 6268;
4609: public const GRID_ALT = 6269;
4610: public const BMC_GRX = 6300;
4611: public const BMC_CTD_LDAP = 6301;
4612: public const UFMP = 6306;
4613: public const SCUP = 6315;
4614: public const ABB_ESCP = 6316;
4615: public const NAV_DATA_CMD = 6317;
4616: public const REPSVC = 6320;
4617: public const EMP_SERVER1 = 6321;
4618: public const EMP_SERVER2 = 6322;
4619: public const HRD_NCS = 6324;
4620: public const DT_MGMTSVC = 6325;
4621: public const DT_VRA = 6326;
4622: public const SFLOW = 6343;
4623: public const STRELETZ = 6344;
4624: public const GNUTELLA_SVC = 6346;
4625: public const GNUTELLA_RTR = 6347;
4626: public const ADAP = 6350;
4627: public const PMCS = 6355;
4628: public const METAEDIT_MU = 6360;
4629: public const METAEDIT_SE = 6370;
4630: public const REDIS = 6379;
4631: public const METATUDE_MDS = 6382;
4632: public const CLARIION_EVR01 = 6389;
4633: public const METAEDIT_WS = 6390;
4634: public const BOE_CMS = 6400;
4635: public const BOE_WAS = 6401;
4636: public const BOE_EVENTSRV = 6402;
4637: public const BOE_CACHESVR = 6403;
4638: public const BOE_FILESVR = 6404;
4639: public const BOE_PAGESVR = 6405;
4640: public const BOE_PROCESSSVR = 6406;
4641: public const BOE_RESSSVR1 = 6407;
4642: public const BOE_RESSSVR2 = 6408;
4643: public const BOE_RESSSVR3 = 6409;
4644: public const BOE_RESSSVR4 = 6410;
4645: public const FAXCOMSERVICE = 6417;
4646: public const SYSERVERREMOTE = 6418;
4647: public const SVDRP = 6419;
4648: public const NIM_VDRSHELL = 6420;
4649: public const NIM_WAN = 6421;
4650: public const PGBOUNCER = 6432;
4651: public const TARP = 6442;
4652: public const SUN_SR_HTTPS = 6443;
4653: public const SGE_QMASTER = 6444;
4654: public const SGE_EXECD = 6445;
4655: public const MYSQL_PROXY = 6446;
4656: public const SKIP_CERT_RECV = 6455;
4657: public const SKIP_CERT_SEND = 6456;
4658: public const IEEE11073_20701 = 6464;
4659: public const LVISION_LM = 6471;
4660: public const SUN_SR_HTTP = 6480;
4661: public const SERVICETAGS = 6481;
4662: public const LDOMS_MGMT = 6482;
4663: public const SUNVTS_RMI = 6483;
4664: public const SUN_SR_JMS = 6484;
4665: public const SUN_SR_IIOP = 6485;
4666: public const SUN_SR_IIOPS = 6486;
4667: public const SUN_SR_IIOP_AUT = 6487;
4668: public const SUN_SR_JMX = 6488;
4669: public const SUN_SR_ADMIN = 6489;
4670: public const BOKS = 6500;
4671: public const BOKS_SERVC = 6501;
4672: public const BOKS_SERVM = 6502;
4673: public const BOKS_CLNTD = 6503;
4674: public const BADM_PRIV = 6505;
4675: public const BADM_PUB = 6506;
4676: public const BDIR_PRIV = 6507;
4677: public const BDIR_PUB = 6508;
4678: public const MGCS_MFP_PORT = 6509;
4679: public const MCER_PORT = 6510;
4680: public const NETCONF_TLS = 6513;
4681: public const SYSLOG_TLS = 6514;
4682: public const ELIPSE_REC = 6515;
4683: public const LDS_DISTRIB = 6543;
4684: public const LDS_DUMP = 6544;
4685: public const APC_6547 = 6547;
4686: public const APC_6548 = 6548;
4687: public const APC_6549 = 6549;
4688: public const FG_SYSUPDATE = 6550;
4689: public const SUM = 6551;
4690: public const XDSXDM = 6558;
4691: public const SANE_PORT = 6566;
4692: public const CANIT_STORE = 6568;
4693: public const AFFILIATE = 6579;
4694: public const PARSEC_MASTER = 6580;
4695: public const PARSEC_PEER = 6581;
4696: public const PARSEC_GAME = 6582;
4697: public const JOAJEWELSUITE = 6583;
4698: public const MSHVLM = 6600;
4699: public const MSTMG_SSTP = 6601;
4700: public const WSSCOMFRMWK = 6602;
4701: public const ODETTE_FTPS = 6619;
4702: public const KFTP_DATA = 6620;
4703: public const KFTP = 6621;
4704: public const MCFTP = 6622;
4705: public const KTELNET = 6623;
4706: public const DATASCALER_DB = 6624;
4707: public const DATASCALER_CTL = 6625;
4708: public const WAGO_SERVICE = 6626;
4709: public const NEXGEN = 6627;
4710: public const AFESC_MC = 6628;
4711: public const NEXGEN_AUX = 6629;
4712: public const MXODBC_CONNECT = 6632;
4713: public const OVSDB = 6640;
4714: public const OPENFLOW = 6653;
4715: public const PCS_SF_UI_MAN = 6655;
4716: public const EMGMSG = 6656;
4717: public const IRCU = 6665;
4718: public const IRCU_2 = 6666;
4719: public const IRCU_3 = 6667;
4720: public const IRCU_4 = 6668;
4721: public const IRCU_5 = 6669;
4722: public const VOCALTEC_GOLD = 6670;
4723: public const P4P_PORTAL = 6671;
4724: public const VISION_SERVER = 6672;
4725: public const VISION_ELMD = 6673;
4726: public const VFBP = 6678;
4727: public const OSAUT = 6679;
4728: public const CLEVER_CTRACE = 6687;
4729: public const CLEVER_TCPIP = 6688;
4730: public const TSA = 6689;
4731: public const CLEVERDETECT = 6690;
4732: public const IRCS_U = 6697;
4733: public const KTI_ICAD_SRVR = 6701;
4734: public const E_DESIGN_NET = 6702;
4735: public const E_DESIGN_WEB = 6703;
4736: public const IBPROTOCOL = 6714;
4737: public const FIBOTRADER_COM = 6715;
4738: public const PRINCITY_AGENT = 6716;
4739: public const BMC_PERF_AGENT = 6767;
4740: public const BMC_PERF_MGRD = 6768;
4741: public const ADI_GXP_SRVPRT = 6769;
4742: public const PLYSRV_HTTP = 6770;
4743: public const PLYSRV_HTTPS = 6771;
4744: public const NTZ_TRACKER = 6777;
4745: public const NTZ_P2P_STORAGE = 6778;
4746: public const DGPF_EXCHG = 6785;
4747: public const SMC_JMX = 6786;
4748: public const SMC_ADMIN = 6787;
4749: public const SMC_HTTP = 6788;
4750: public const RADG = 6789;
4751: public const HNMP = 6790;
4752: public const HNM = 6791;
4753: public const ACNET = 6801;
4754: public const PENTBOX_SIM = 6817;
4755: public const AMBIT_LM = 6831;
4756: public const NETMO_DEFAULT = 6841;
4757: public const NETMO_HTTP = 6842;
4758: public const ICCRUSHMORE = 6850;
4759: public const ACCTOPUS_CC = 6868;
4760: public const MUSE = 6888;
4761: public const RTIMEVIEWER = 6900;
4762: public const JETSTREAM = 6901;
4763: public const ETHOSCAN = 6935;
4764: public const XSMSVC = 6936;
4765: public const BIOSERVER = 6946;
4766: public const OTLP = 6951;
4767: public const JMACT3 = 6961;
4768: public const JMEVT2 = 6962;
4769: public const SWISMGR1 = 6963;
4770: public const SWISMGR2 = 6964;
4771: public const SWISTRAP = 6965;
4772: public const SWISPOL = 6966;
4773: public const ACMSODA = 6969;
4774: public const CONDUCTOR = 6970;
4775: public const MOBILITYSRV = 6997;
4776: public const IATP_HIGHPRI = 6998;
4777: public const IATP_NORMALPRI = 6999;
4778: public const AFS3_FILESERVER = 7000;
4779: public const AFS3_CALLBACK = 7001;
4780: public const AFS3_PRSERVER = 7002;
4781: public const AFS3_VLSERVER = 7003;
4782: public const AFS3_KASERVER = 7004;
4783: public const AFS3_VOLSER = 7005;
4784: public const AFS3_ERRORS = 7006;
4785: public const AFS3_BOS = 7007;
4786: public const AFS3_UPDATE = 7008;
4787: public const AFS3_RMTSYS = 7009;
4788: public const UPS_ONLINET = 7010;
4789: public const TALON_DISC = 7011;
4790: public const TALON_ENGINE = 7012;
4791: public const MICROTALON_DIS = 7013;
4792: public const MICROTALON_COM = 7014;
4793: public const TALON_WEBSERVER = 7015;
4794: public const SPG = 7016;
4795: public const GRASP = 7017;
4796: public const FISA_SVC = 7018;
4797: public const DOCERI_CTL = 7019;
4798: public const DPSERVE = 7020;
4799: public const DPSERVEADMIN = 7021;
4800: public const CTDP = 7022;
4801: public const CT2NMCS = 7023;
4802: public const VMSVC = 7024;
4803: public const VMSVC_2 = 7025;
4804: public const OP_PROBE = 7030;
4805: public const IPOSPLANET = 7031;
4806: public const ARCP = 7070;
4807: public const IWG1 = 7071;
4808: public const IBA_CFG = 7072;
4809: public const MARTALK = 7073;
4810: public const EMPOWERID = 7080;
4811: public const LAZY_PTOP = 7099;
4812: public const FONT_SERVICE = 7100;
4813: public const ELCN = 7101;
4814: public const ROTHAGA = 7117;
4815: public const VIRPROT_LM = 7121;
4816: public const SCENIDM = 7128;
4817: public const SCENCCS = 7129;
4818: public const CABSM_COMM = 7161;
4819: public const CAISTORAGEMGR = 7162;
4820: public const CACSAMBROKER = 7163;
4821: public const FSR = 7164;
4822: public const DOC_SERVER = 7165;
4823: public const ARUBA_SERVER = 7166;
4824: public const CASRMAGENT = 7167;
4825: public const CNCKADSERVER = 7168;
4826: public const CCAG_PIB = 7169;
4827: public const NSRP = 7170;
4828: public const DRM_PRODUCTION = 7171;
4829: public const METALBEND = 7172;
4830: public const ZSECURE = 7173;
4831: public const CLUTILD = 7174;
4832: public const FODMS = 7200;
4833: public const DLIP = 7201;
4834: public const PON_ICTP = 7202;
4835: public const PS_SERVER = 7215;
4836: public const PS_CAPTURE_PRO = 7216;
4837: public const RAMP = 7227;
4838: public const CITRIXUPP = 7228;
4839: public const CITRIXUPPG = 7229;
4840: public const DISPLAY = 7236;
4841: public const PADS = 7237;
4842: public const FRC_HICP = 7244;
4843: public const CNAP = 7262;
4844: public const WATCHME_7272 = 7272;
4845: public const OMA_RLP = 7273;
4846: public const OMA_RLP_S = 7274;
4847: public const OMA_ULP = 7275;
4848: public const OMA_ILP = 7276;
4849: public const OMA_ILP_S = 7277;
4850: public const OMA_DCDOCBS = 7278;
4851: public const CTXLIC = 7279;
4852: public const ITACTIONSERVER1 = 7280;
4853: public const ITACTIONSERVER2 = 7281;
4854: public const MZCA_ACTION = 7282;
4855: public const GENSTAT = 7283;
4856: public const SWX = 7300; // 7300-7359
4857: public const LCM_SERVER = 7365;
4858: public const MINDFILESYS = 7391;
4859: public const MRSSRENDEZVOUS = 7392;
4860: public const NFOLDMAN = 7393;
4861: public const FSE = 7394;
4862: public const WINQEDIT = 7395;
4863: public const HEXARC = 7397;
4864: public const RTPS_DISCOVERY = 7400;
4865: public const RTPS_DD_UT = 7401;
4866: public const RTPS_DD_MT = 7402;
4867: public const IONIXNETMON = 7410;
4868: public const DAQSTREAM = 7411;
4869: public const MTPORTMON = 7421;
4870: public const PMDMGR = 7426;
4871: public const OVEADMGR = 7427;
4872: public const OVLADMGR = 7428;
4873: public const OPI_SOCK = 7429;
4874: public const XMPV7 = 7430;
4875: public const PMD = 7431;
4876: public const FAXIMUM = 7437;
4877: public const ORACLEAS_HTTPS = 7443;
4878: public const STTUNNEL = 7471;
4879: public const RISE = 7473;
4880: public const NEO4J = 7474;
4881: public const OPENIT = 7478;
4882: public const TELOPS_LMD = 7491;
4883: public const SILHOUETTE = 7500;
4884: public const OVBUS = 7501;
4885: public const ADCP = 7508;
4886: public const ACPLT = 7509;
4887: public const OVHPAS = 7510;
4888: public const PAFEC_LM = 7511;
4889: public const SARATOGA = 7542;
4890: public const ATUL = 7543;
4891: public const NTA_DS = 7544;
4892: public const NTA_US = 7545;
4893: public const CFS = 7546;
4894: public const CWMP = 7547;
4895: public const TIDP = 7548;
4896: public const NLS_TL = 7549;
4897: public const CONTROLONE_CON = 7551;
4898: public const SNCP = 7560;
4899: public const CFW = 7563;
4900: public const VSI_OMEGA = 7566;
4901: public const DELL_EQL_ASM = 7569;
4902: public const ARIES_KFINDER = 7570;
4903: public const COHERENCE = 7574;
4904: public const SUN_LM = 7588;
4905: public const MIPI_DEBUG = 7606;
4906: public const INDI = 7624;
4907: public const SIMCO = 7626;
4908: public const SOAP_HTTP = 7627;
4909: public const ZEN_PAWN = 7628;
4910: public const XDAS = 7629;
4911: public const HAWK = 7630;
4912: public const TESLA_SYS_MSG = 7631;
4913: public const PMDFMGT = 7633;
4914: public const CUSEEME = 7648;
4915: public const ROME = 7663;
4916: public const IMQSTOMP = 7672;
4917: public const IMQSTOMPS = 7673;
4918: public const IMQTUNNELS = 7674;
4919: public const IMQTUNNEL = 7675;
4920: public const IMQBROKERD = 7676;
4921: public const SUN_USER_HTTPS = 7677;
4922: public const PANDO_PUB = 7680;
4923: public const DMT = 7683;
4924: public const BOLT = 7687;
4925: public const COLLABER = 7689;
4926: public const KLIO = 7697;
4927: public const EM7_SECOM = 7700;
4928: public const SYNC_EM7 = 7707;
4929: public const SCINET = 7708;
4930: public const MEDIMAGEPORTAL = 7720;
4931: public const NSDEEPFREEZECTL = 7724;
4932: public const NITROGEN = 7725;
4933: public const FREEZEXSERVICE = 7726;
4934: public const TRIDENT_DATA = 7727;
4935: public const OSVR = 7728;
4936: public const SMIP = 7734;
4937: public const AIAGENT = 7738;
4938: public const SCRIPTVIEW = 7741;
4939: public const MSSS = 7742;
4940: public const SSTP_1 = 7743;
4941: public const RAQMON_PDU = 7744;
4942: public const PRGP = 7747;
4943: public const INETFS = 7775;
4944: public const CBT = 7777;
4945: public const INTERWISE = 7778;
4946: public const VSTAT = 7779;
4947: public const ACCU_LMGR = 7781;
4948: public const MINIVEND = 7786;
4949: public const POPUP_REMINDERS = 7787;
4950: public const OFFICE_TOOLS = 7789;
4951: public const Q3ADE = 7794;
4952: public const PNET_CONN = 7797;
4953: public const PNET_ENC = 7798;
4954: public const ALTBSDP = 7799;
4955: public const ASR = 7800;
4956: public const SSP_CLIENT = 7801;
4957: public const RBT_WANOPT = 7810;
4958: public const APC_7845 = 7845;
4959: public const APC_7846 = 7846;
4960: public const CSOAUTH = 7847;
4961: public const MOBILEANALYZER = 7869;
4962: public const RBT_SMC = 7870;
4963: public const MDM = 7871;
4964: public const OWMS = 7878;
4965: public const PSS = 7880;
4966: public const UBROKER = 7887;
4967: public const MEVENT = 7900;
4968: public const TNOS_SP = 7901;
4969: public const TNOS_DP = 7902;
4970: public const TNOS_DPS = 7903;
4971: public const QO_SECURE = 7913;
4972: public const T2_DRM = 7932;
4973: public const T2_BRM = 7933;
4974: public const GENERALSYNC = 7962;
4975: public const SUPERCELL = 7967;
4976: public const MICROMUSE_NCPS = 7979;
4977: public const QUEST_VISTA = 7980;
4978: public const SOSSD_COLLECT = 7981;
4979: public const SOSSD_AGENT = 7982;
4980: public const PUSHNS = 7997;
4981: public const IRDMI2 = 7999;
4982: public const IRDMI = 8000;
4983: public const VCOM_TUNNEL = 8001;
4984: public const TERADATAORDBMS = 8002;
4985: public const MCREPORT = 8003;
4986: public const P2PEVOLVENET = 8004;
4987: public const MXI = 8005;
4988: public const WPL_ANALYTICS = 8006;
4989: public const WARPPIPE = 8007;
4990: public const HTTP_ALT_2 = 8008;
4991: public const QBDB = 8019;
4992: public const INTU_EC_SVCDISC = 8020;
4993: public const INTU_EC_CLIENT = 8021;
4994: public const OA_SYSTEM = 8022;
4995: public const CA_AUDIT_DA = 8025;
4996: public const CA_AUDIT_DS = 8026;
4997: public const PRO_ED = 8032;
4998: public const MINDPRINT = 8033;
4999: public const VANTRONIX_MGMT = 8034;
5000: public const AMPIFY = 8040;
5001: public const ENGUITY_XCCETP = 8041;
5002: public const FS_AGENT = 8042;
5003: public const FS_SERVER = 8043;
5004: public const FS_MGMT = 8044;
5005: public const ROCRAIL = 8051;
5006: public const SENOMIX01 = 8052;
5007: public const SENOMIX02 = 8053;
5008: public const SENOMIX03 = 8054;
5009: public const SENOMIX04 = 8055;
5010: public const SENOMIX05 = 8056;
5011: public const SENOMIX06 = 8057;
5012: public const SENOMIX07 = 8058;
5013: public const SENOMIX08 = 8059;
5014: public const TOAD_BI_APPSRVR = 8066;
5015: public const INFI_ASYNC = 8067;
5016: public const UCS_ISC = 8070;
5017: public const GADUGADU = 8074;
5018: public const MLES = 8077;
5019: public const HTTP_ALT_3 = 8080;
5020: public const SUNPROXYADMIN = 8081;
5021: public const US_CLI = 8082;
5022: public const US_SRV = 8083;
5023: public const D_S_N = 8086;
5024: public const SIMPLIFYMEDIA = 8087;
5025: public const RADAN_HTTP = 8088;
5026: public const OPSMESSAGING = 8090;
5027: public const JAMLINK = 8091;
5028: public const SAC = 8097;
5029: public const XPRINT_SERVER = 8100;
5030: public const LDOMS_MIGR = 8101;
5031: public const KZ_MIGR = 8102;
5032: public const MTL8000_MATRIX = 8115;
5033: public const CP_CLUSTER = 8116;
5034: public const PURITYRPC = 8117;
5035: public const PRIVOXY = 8118;
5036: public const APOLLO_DATA = 8121;
5037: public const APOLLO_ADMIN = 8122;
5038: public const PAYCASH_ONLINE = 8128;
5039: public const PAYCASH_WBP = 8129;
5040: public const INDIGO_VRMI = 8130;
5041: public const INDIGO_VBCP = 8131;
5042: public const DBABBLE = 8132;
5043: public const PUPPET = 8140;
5044: public const ISDD = 8148;
5045: public const QUANTASTOR = 8153;
5046: public const PATROL = 8160;
5047: public const PATROL_SNMP = 8161;
5048: public const LPAR2RRD = 8162;
5049: public const INTERMAPPER = 8181;
5050: public const VMWARE_FDM = 8182;
5051: public const PROREMOTE = 8183;
5052: public const ITACH = 8184;
5053: public const GCP_RPHY = 8190;
5054: public const LIMNERPRESSURE = 8191;
5055: public const SPYTECHPHONE = 8192;
5056: public const BLP1 = 8194;
5057: public const BLP2 = 8195;
5058: public const VVR_DATA = 8199;
5059: public const TRIVNET1 = 8200;
5060: public const TRIVNET2 = 8201;
5061: public const LM_PERFWORKS = 8204;
5062: public const LM_INSTMGR = 8205;
5063: public const LM_DTA = 8206;
5064: public const LM_SSERVER = 8207;
5065: public const LM_WEBWATCHER = 8208;
5066: public const REXECJ = 8230;
5067: public const SYNAPSE_NHTTPS = 8243;
5068: public const ROBOT_REMOTE = 8270;
5069: public const PANDO_SEC = 8276;
5070: public const SYNAPSE_NHTTP = 8280;
5071: public const LIBELLE = 8282;
5072: public const BLP3 = 8292;
5073: public const HIPERSCAN_ID = 8293;
5074: public const BLP4 = 8294;
5075: public const TMI = 8300;
5076: public const AMBERON = 8301;
5077: public const HUB_OPEN_NET = 8313;
5078: public const TNP_DISCOVER = 8320;
5079: public const TNP = 8321;
5080: public const GARMIN_MARINE = 8322;
5081: public const SERVER_FIND = 8351;
5082: public const CRUISE_ENUM = 8376;
5083: public const CRUISE_SWROUTE = 8377;
5084: public const CRUISE_CONFIG = 8378;
5085: public const CRUISE_DIAGS = 8379;
5086: public const CRUISE_UPDATE = 8380;
5087: public const M2MSERVICES = 8383;
5088: public const CVD = 8400;
5089: public const SABARSD = 8401;
5090: public const ABARSD = 8402;
5091: public const ADMIND_2 = 8403;
5092: public const SVCLOUD = 8404;
5093: public const SVBACKUP = 8405;
5094: public const DLPX_SP = 8415;
5095: public const ESPEECH = 8416;
5096: public const ESPEECH_RTP = 8417;
5097: public const ARITTS = 8423;
5098: public const CYBRO_A_BUS = 8442;
5099: public const PCSYNC_HTTPS = 8443;
5100: public const PCSYNC_HTTP = 8444;
5101: public const COPY = 8445;
5102: public const NPMP = 8450;
5103: public const NEXENTAMV = 8457;
5104: public const CISCO_AVP = 8470;
5105: public const PIM_PORT = 8471;
5106: public const OTV = 8472;
5107: public const VP2P = 8473;
5108: public const NOTESHARE = 8474;
5109: public const FMTP = 8500;
5110: public const CMTP_MGT = 8501;
5111: public const FTNMTP = 8502;
5112: public const RTSP_ALT = 8554;
5113: public const D_FENCE = 8555;
5114: public const DOF_TUNNEL = 8567;
5115: public const ASTERIX = 8600;
5116: public const CANON_MFNP = 8610;
5117: public const CANON_BJNP1 = 8611;
5118: public const CANON_BJNP2 = 8612;
5119: public const CANON_BJNP3 = 8613;
5120: public const CANON_BJNP4 = 8614;
5121: public const IMINK = 8615;
5122: public const MONETRA = 8665;
5123: public const MONETRA_ADMIN = 8666;
5124: public const MSI_CPS_RM = 8675;
5125: public const SUN_AS_JMXRMI = 8686;
5126: public const OPENREMOTE_CTRL = 8688;
5127: public const VNYX = 8699;
5128: public const NVC = 8711;
5129: public const IBUS = 8733;
5130: public const DEY_KEYNEG = 8750;
5131: public const MC_APPSERVER = 8763;
5132: public const OPENQUEUE = 8764;
5133: public const ULTRASEEK_HTTP = 8765;
5134: public const AMCS = 8766;
5135: public const DPAP = 8770;
5136: public const UEC = 8778;
5137: public const MSGCLNT = 8786;
5138: public const MSGSRVR = 8787;
5139: public const ACD_PM = 8793;
5140: public const SUNWEBADMIN = 8800;
5141: public const TRUECM = 8804;
5142: public const DXSPIDER = 8873;
5143: public const CDDBP_ALT = 8880;
5144: public const GALAXY4D = 8881;
5145: public const SECURE_MQTT = 8883;
5146: public const DDI_TCP_1 = 8888;
5147: public const DDI_TCP_2 = 8889;
5148: public const DDI_TCP_3 = 8890;
5149: public const DDI_TCP_4 = 8891;
5150: public const DDI_TCP_5 = 8892;
5151: public const DDI_TCP_6 = 8893;
5152: public const DDI_TCP_7 = 8894;
5153: public const OSPF_LITE = 8899;
5154: public const JMB_CDS1 = 8900;
5155: public const JMB_CDS2 = 8901;
5156: public const MANYONE_HTTP = 8910;
5157: public const MANYONE_XML = 8911;
5158: public const WCBACKUP = 8912;
5159: public const DRAGONFLY = 8913;
5160: public const TWDS = 8937;
5161: public const UB_DNS_CONTROL = 8953;
5162: public const CUMULUS_ADMIN = 8954;
5163: public const NOD_PROVIDER = 8980;
5164: public const SUNWEBADMINS = 8989;
5165: public const HTTP_WMAP = 8990;
5166: public const HTTPS_WMAP = 8991;
5167: public const ORACLE_MS_ENS = 8997;
5168: public const CANTO_ROBOFLOW = 8998;
5169: public const BCTP = 8999;
5170: public const CSLISTENER = 9000;
5171: public const ETLSERVICEMGR = 9001;
5172: public const DYNAMID = 9002;
5173: public const GOLEM = 9005;
5174: public const OGS_SERVER = 9008;
5175: public const PICHAT = 9009;
5176: public const SDR = 9010;
5177: public const TAMBORA = 9020;
5178: public const PANAGOLIN_IDENT = 9021;
5179: public const PARAGENT = 9022;
5180: public const SWA_1 = 9023;
5181: public const SWA_2 = 9024;
5182: public const SWA_3 = 9025;
5183: public const SWA_4 = 9026;
5184: public const VERSIERA = 9050;
5185: public const FIO_CMGMT = 9051;
5186: public const CARDWEB_IO = 9060;
5187: public const GLRPC = 9080;
5188: public const EMC_PP_MGMTSVC = 9083;
5189: public const AURORA = 9084;
5190: public const IBM_RSYSCON = 9085;
5191: public const NET2DISPLAY = 9086;
5192: public const CLASSIC = 9087;
5193: public const SQLEXEC = 9088;
5194: public const SQLEXEC_SSL = 9089;
5195: public const WEBSM = 9090;
5196: public const XMLTEC_XMLMAIL = 9091;
5197: public const XMLIPCREGSVC = 9092;
5198: public const COPYCAT = 9093;
5199: public const HP_PDL_DATASTR = 9100;
5200: public const PDL_DATASTREAM = 9100;
5201: public const BACULA_DIR = 9101;
5202: public const BACULA_FD = 9102;
5203: public const BACULA_SD = 9103;
5204: public const PEERWIRE = 9104;
5205: public const XADMIN = 9105;
5206: public const ASTERGATE = 9106;
5207: public const ASTERGATEFAX = 9107;
5208: public const MXIT = 9119;
5209: public const GRCMP = 9122;
5210: public const GRCP = 9123;
5211: public const DDDP = 9131;
5212: public const APANI1 = 9160;
5213: public const APANI2 = 9161;
5214: public const APANI3 = 9162;
5215: public const APANI4 = 9163;
5216: public const APANI5 = 9164;
5217: public const SUN_AS_JPDA = 9191;
5218: public const WAP_WSP = 9200;
5219: public const WAP_WSP_WTP = 9201;
5220: public const WAP_WSP_S = 9202;
5221: public const WAP_WSP_WTP_S = 9203;
5222: public const WAP_VCARD = 9204;
5223: public const WAP_VCAL = 9205;
5224: public const WAP_VCARD_S = 9206;
5225: public const WAP_VCAL_S = 9207;
5226: public const RJCDB_VCARDS = 9208;
5227: public const ALMOBILE_SYSTEM = 9209;
5228: public const OMA_MLP = 9210;
5229: public const OMA_MLP_S = 9211;
5230: public const SERVERVIEWDBMS = 9212;
5231: public const SERVERSTART = 9213;
5232: public const IPDCESGBS = 9214;
5233: public const INSIS = 9215;
5234: public const ACME = 9216;
5235: public const FSC_PORT = 9217;
5236: public const TEAMCOHERENCE = 9222;
5237: public const MON_2 = 9255;
5238: public const PEGASUS = 9278;
5239: public const PEGASUS_CTL = 9279;
5240: public const PGPS = 9280;
5241: public const SWTP_PORT1 = 9281;
5242: public const SWTP_PORT2 = 9282;
5243: public const CALLWAVEIAM = 9283;
5244: public const VISD = 9284;
5245: public const N2H2SERVER = 9285;
5246: public const CUMULUS = 9287;
5247: public const ARMTECHDAEMON = 9292;
5248: public const STORVIEW = 9293;
5249: public const ARMCENTERHTTP = 9294;
5250: public const ARMCENTERHTTPS = 9295;
5251: public const VRACE = 9300;
5252: public const SPHINXQL = 9306;
5253: public const SPHINXAPI = 9312;
5254: public const SECURE_TS = 9318;
5255: public const GUIBASE = 9321;
5256: public const MPIDCMGR = 9343;
5257: public const MPHLPDMC = 9344;
5258: public const RANCHER = 9345;
5259: public const CTECHLICENSING = 9346;
5260: public const FJDMIMGR = 9374;
5261: public const BOXP = 9380;
5262: public const D2DCONFIG = 9387;
5263: public const D2DDATATRANS = 9388;
5264: public const ADWS = 9389;
5265: public const OTP = 9390;
5266: public const FJINVMGR = 9396;
5267: public const MPIDCAGT = 9397;
5268: public const SEC_T4NET_SRV = 9400;
5269: public const SEC_T4NET_CLT = 9401;
5270: public const SEC_PC2FAX_SRV = 9402;
5271: public const GIT = 9418;
5272: public const TUNGSTEN_HTTPS = 9443;
5273: public const WSO2ESB_CONSOLE = 9444;
5274: public const MINDARRAY_CA = 9445;
5275: public const SNTLKEYSSRVR = 9450;
5276: public const ISMSERVER = 9500;
5277: public const MNGSUITE = 9535;
5278: public const LAES_BF = 9536;
5279: public const TRISPEN_SRA = 9555;
5280: public const LDGATEWAY = 9592;
5281: public const CBA8 = 9593;
5282: public const MSGSYS = 9594;
5283: public const PDS = 9595;
5284: public const MERCURY_DISC = 9596;
5285: public const PD_ADMIN = 9597;
5286: public const VSCP = 9598;
5287: public const ROBIX = 9599;
5288: public const MICROMUSE_NCPW = 9600;
5289: public const STREAMCOMM_DS = 9612;
5290: public const IADT_TLS = 9614;
5291: public const ERUNBOOK_AGENT = 9616;
5292: public const ERUNBOOK_SERVER = 9617;
5293: public const CONDOR = 9618;
5294: public const ODBCPATHWAY = 9628;
5295: public const UNIPORT = 9629;
5296: public const PEOCTLR = 9630;
5297: public const PEOCOLL = 9631;
5298: public const PQSFLOWS = 9640;
5299: public const ZOOMCP = 9666;
5300: public const XMMS2 = 9667;
5301: public const TEC5_SDCTP = 9668;
5302: public const CLIENT_WAKEUP = 9694;
5303: public const CCNX = 9695;
5304: public const BOARD_ROAR = 9700;
5305: public const L5NAS_PARCHAN = 9747;
5306: public const BOARD_VOIP = 9750;
5307: public const RASADV = 9753;
5308: public const TUNGSTEN_HTTP = 9762;
5309: public const DAVSRC = 9800;
5310: public const SSTP_2 = 9801;
5311: public const DAVSRCS = 9802;
5312: public const SAPV1 = 9875;
5313: public const SD = 9876;
5314: public const CYBORG_SYSTEMS = 9888;
5315: public const GT_PROXY = 9889;
5316: public const MONKEYCOM = 9898;
5317: public const IUA = 9900;
5318: public const DOMAINTIME = 9909;
5319: public const SYPE_TRANSPORT = 9911;
5320: public const XYBRID_CLOUD = 9925;
5321: public const APC_9950 = 9950;
5322: public const APC_9951 = 9951;
5323: public const APC_9952 = 9952;
5324: public const ACIS = 9953;
5325: public const HINP = 9954;
5326: public const ALLJOYN_STM = 9955;
5327: public const ODNSP = 9966;
5328: public const XYBRID_RT = 9978;
5329: public const VISWEATHER = 9979;
5330: public const PUMPKINDB = 9981;
5331: public const DSM_SCM_TARGET = 9987;
5332: public const NSESRVR = 9988;
5333: public const OSM_APPSRVR = 9990;
5334: public const OSM_OEV = 9991;
5335: public const PALACE_1 = 9992;
5336: public const PALACE_2 = 9993;
5337: public const PALACE_3 = 9994;
5338: public const PALACE_4 = 9995;
5339: public const PALACE_5 = 9996;
5340: public const PALACE_6 = 9997;
5341: public const DISTINCT32 = 9998;
5342: public const DISTINCT = 9999;
5343: public const NDMP = 10000;
5344: public const SCP_CONFIG = 10001;
5345: public const DOCUMENTUM = 10002;
5346: public const DOCUMENTUM_S = 10003;
5347: public const EMCRMIRCCD = 10004;
5348: public const EMCRMIRD = 10005;
5349: public const NETAPP_SYNC = 10006;
5350: public const MVS_CAPACITY = 10007;
5351: public const OCTOPUS = 10008;
5352: public const SWDTP_SV = 10009;
5353: public const RXAPI = 10010;
5354: public const ABB_HW = 10020;
5355: public const ZABBIX_AGENT = 10050;
5356: public const ZABBIX_TRAPPER = 10051;
5357: public const QPTLMD = 10055;
5358: public const AMANDA = 10080;
5359: public const FAMDC = 10081;
5360: public const ITAP_DDTP = 10100;
5361: public const EZMEETING_2 = 10101;
5362: public const EZPROXY_2 = 10102;
5363: public const EZRELAY = 10103;
5364: public const SWDTP = 10104;
5365: public const BCTP_SERVER = 10107;
5366: public const NMEA_0183 = 10110;
5367: public const NETIQ_ENDPOINT = 10113;
5368: public const NETIQ_QCHECK = 10114;
5369: public const NETIQ_ENDPT = 10115;
5370: public const NETIQ_VOIPA = 10116;
5371: public const IQRM = 10117;
5372: public const CIMPLE = 10125;
5373: public const BMC_PERF_SD = 10128;
5374: public const BMC_GMS = 10129;
5375: public const QB_DB_SERVER = 10160;
5376: public const SNMPTLS = 10161;
5377: public const SNMPTLS_TRAP = 10162;
5378: public const TRISOAP = 10200;
5379: public const RSMS = 10201;
5380: public const APOLLO_RELAY = 10252;
5381: public const AXIS_WIMP_PORT = 10260;
5382: public const TILE_ML = 10261;
5383: public const BLOCKS = 10288;
5384: public const COSIR = 10321;
5385: public const MOS_LOWER = 10540;
5386: public const MOS_UPPER = 10541;
5387: public const MOS_AUX = 10542;
5388: public const MOS_SOAP = 10543;
5389: public const MOS_SOAP_OPT = 10544;
5390: public const SERVERDOCS = 10548;
5391: public const PRINTOPIA = 10631;
5392: public const GAP = 10800;
5393: public const LPDG = 10805;
5394: public const NBD = 10809;
5395: public const HELIX = 10860;
5396: public const BVEAPI = 10880;
5397: public const OCTOPUSTENTACLE = 10933;
5398: public const RMIAUX = 10990;
5399: public const IRISA = 11000;
5400: public const METASYS = 11001;
5401: public const WEAVE = 11095;
5402: public const ORIGO_SYNC = 11103;
5403: public const NETAPP_ICMGMT = 11104;
5404: public const NETAPP_ICDATA = 11105;
5405: public const SGI_LK = 11106;
5406: public const SGI_DMFMGR = 11109;
5407: public const SGI_SOAP = 11110;
5408: public const VCE = 11111;
5409: public const DICOM = 11112;
5410: public const SUNCACAO_SNMP = 11161;
5411: public const SUNCACAO_JMXMP = 11162;
5412: public const SUNCACAO_RMI = 11163;
5413: public const SUNCACAO_CSA = 11164;
5414: public const SUNCACAO_WEBSVC = 11165;
5415: public const OEMCACAO_JMXMP = 11172;
5416: public const T5_STRATON = 11173;
5417: public const OEMCACAO_RMI = 11174;
5418: public const OEMCACAO_WEBSVC = 11175;
5419: public const SMSQP = 11201;
5420: public const DCSL_BACKUP = 11202;
5421: public const WIFREE = 11208;
5422: public const MEMCACHE = 11211;
5423: public const IMIP = 11319;
5424: public const IMIP_CHANNELS = 11320;
5425: public const ARENA_SERVER = 11321;
5426: public const ATM_UHAS = 11367;
5427: public const HKP = 11371;
5428: public const ASGCYPRESSTCPS = 11489;
5429: public const TEMPEST_PORT = 11600;
5430: public const EMC_XSW_DCONFIG = 11623;
5431: public const H323CALLSIGALT = 11720;
5432: public const EMC_XSW_DCACHE = 11723;
5433: public const INTREPID_SSL = 11751;
5434: public const LANSCHOOL = 11796;
5435: public const XORAYA = 11876;
5436: public const SYSINFO_SP = 11967;
5437: public const ENTEXTXID = 12000;
5438: public const ENTEXTNETWK = 12001;
5439: public const ENTEXTHIGH = 12002;
5440: public const ENTEXTMED = 12003;
5441: public const ENTEXTLOW = 12004;
5442: public const DBISAMSERVER1 = 12005;
5443: public const DBISAMSERVER2 = 12006;
5444: public const ACCURACER = 12007;
5445: public const ACCURACER_DBMS = 12008;
5446: public const EDBSRVR = 12010;
5447: public const VIPERA = 12012;
5448: public const VIPERA_SSL = 12013;
5449: public const RETS_SSL = 12109;
5450: public const NUPAPER_SS = 12121;
5451: public const CAWAS = 12168;
5452: public const HIVEP = 12172;
5453: public const LINOGRIDENGINE = 12300;
5454: public const RADS = 12302;
5455: public const WAREHOUSE_SSS = 12321;
5456: public const WAREHOUSE = 12322;
5457: public const ITALK = 12345;
5458: public const TSAF = 12753;
5459: public const NETPERF = 12865;
5460: public const I_ZIPQD = 13160;
5461: public const BCSLOGC = 13216;
5462: public const RS_PIAS = 13217;
5463: public const EMC_VCAS_TCP = 13218;
5464: public const POWWOW_CLIENT = 13223;
5465: public const POWWOW_SERVER = 13224;
5466: public const DOIP_DATA = 13400;
5467: public const BPRD = 13720;
5468: public const BPDBM = 13721;
5469: public const BPJAVA_MSVC = 13722;
5470: public const VNETD = 13724;
5471: public const BPCD = 13782;
5472: public const VOPIED = 13783;
5473: public const NBDB = 13785;
5474: public const NOMDB = 13786;
5475: public const DSMCC_CONFIG = 13818;
5476: public const DSMCC_SESSION = 13819;
5477: public const DSMCC_PASSTHRU = 13820;
5478: public const DSMCC_DOWNLOAD = 13821;
5479: public const DSMCC_CCP = 13822;
5480: public const BMDSS = 13823;
5481: public const UCONTROL = 13894;
5482: public const DTA_SYSTEMS = 13929;
5483: public const MEDEVOLVE = 13930;
5484: public const SCOTTY_FT = 14000;
5485: public const SUA = 14001;
5486: public const SAGE_BEST_COM1 = 14033;
5487: public const SAGE_BEST_COM2 = 14034;
5488: public const VCS_APP = 14141;
5489: public const ICPP = 14142;
5490: public const ICPPS = 14143;
5491: public const GCM_APP = 14145;
5492: public const VRTS_TDD = 14149;
5493: public const VCSCMD = 14150;
5494: public const VAD = 14154;
5495: public const CPS = 14250;
5496: public const CA_WEB_UPDATE = 14414;
5497: public const XPRA = 14500;
5498: public const HDE_LCESRVR_1 = 14936;
5499: public const HDE_LCESRVR_2 = 14937;
5500: public const HYDAP = 15000;
5501: public const ONEP_TLS = 15002;
5502: public const XPILOT = 15345;
5503: public const _3LINK = 15363;
5504: public const CISCO_SNAT = 15555;
5505: public const BEX_XR = 15660;
5506: public const PTP = 15740;
5507: public const PROGRAMMAR = 15999;
5508: public const FMSAS = 16000;
5509: public const FMSASCON = 16001;
5510: public const GSMS = 16002;
5511: public const JWPC = 16020;
5512: public const JWPC_BIN = 16021;
5513: public const SUN_SEA_PORT = 16161;
5514: public const SOLARIS_AUDIT = 16162;
5515: public const ETB4J = 16309;
5516: public const PDUNCS = 16310;
5517: public const PDEFMNS = 16311;
5518: public const NETSERIALEXT1 = 16360;
5519: public const NETSERIALEXT2 = 16361;
5520: public const NETSERIALEXT3 = 16367;
5521: public const NETSERIALEXT4 = 16368;
5522: public const CONNECTED = 16384;
5523: public const RDGS = 16385;
5524: public const XOMS = 16619;
5525: public const AXON_TUNNEL = 16665;
5526: public const CADSISVR = 16789;
5527: public const NEWBAY_SNC_MC = 16900;
5528: public const SGCIP = 16950;
5529: public const INTEL_RCI_MP = 16991;
5530: public const AMT_SOAP_HTTP = 16992;
5531: public const AMT_SOAP_HTTPS = 16993;
5532: public const AMT_REDIR_TCP = 16994;
5533: public const AMT_REDIR_TLS = 16995;
5534: public const ISODE_DUA = 17007;
5535: public const VESTASDLP = 17184;
5536: public const SOUNDSVIRTUAL = 17185;
5537: public const CHIPPER = 17219;
5538: public const AVTP = 17220;
5539: public const AVDECC = 17221;
5540: public const ISA100_GCI = 17223;
5541: public const TRDP_MD = 17225;
5542: public const INTEGRIUS_STP = 17234;
5543: public const SSH_MGMT = 17235;
5544: public const DB_LSP = 17500;
5545: public const AILITH = 17555;
5546: public const EA = 17729;
5547: public const ZEP = 17754;
5548: public const ZIGBEE_IP = 17755;
5549: public const ZIGBEE_IPS = 17756;
5550: public const SW_ORION = 17777;
5551: public const BIIMENU = 18000;
5552: public const RADPDF = 18104;
5553: public const RACF = 18136;
5554: public const OPSEC_CVP = 18181;
5555: public const OPSEC_UFP = 18182;
5556: public const OPSEC_SAM = 18183;
5557: public const OPSEC_LEA = 18184;
5558: public const OPSEC_OMI = 18185;
5559: public const OHSC = 18186;
5560: public const OPSEC_ELA = 18187;
5561: public const CHECKPOINT_RTM = 18241;
5562: public const ICLID = 18242;
5563: public const CLUSTERXL = 18243;
5564: public const GV_PF = 18262;
5565: public const AC_CLUSTER = 18463;
5566: public const RDS_IB = 18634;
5567: public const RDS_IP = 18635;
5568: public const VDMMESH = 18668;
5569: public const IQUE = 18769;
5570: public const INFOTOS = 18881;
5571: public const APC_NECMP = 18888;
5572: public const IGRID = 19000;
5573: public const SCINTILLA = 19007;
5574: public const J_LINK = 19020;
5575: public const OPSEC_UAA = 19191;
5576: public const UA_SECUREAGENT = 19194;
5577: public const CORA = 19220;
5578: public const KEYSRVR = 19283;
5579: public const KEYSHADOW = 19315;
5580: public const MTRGTRANS = 19398;
5581: public const HP_SCO = 19410;
5582: public const HP_SCA = 19411;
5583: public const HP_SESSMON = 19412;
5584: public const FXUPTP = 19539;
5585: public const SXUPTP = 19540;
5586: public const JCP = 19541;
5587: public const IEC_104_SEC = 19998;
5588: public const DNP_SEC = 19999;
5589: public const DNP = 20000;
5590: public const MICROSAN = 20001;
5591: public const COMMTACT_HTTP = 20002;
5592: public const COMMTACT_HTTPS = 20003;
5593: public const OPENWEBNET = 20005;
5594: public const SS_IDI = 20013;
5595: public const OPENDEPLOY = 20014;
5596: public const NBURN_ID = 20034;
5597: public const TMOPHL7MTS = 20046;
5598: public const MOUNTD = 20048;
5599: public const NFSRDMA = 20049;
5600: public const AVESTERRA = 20057;
5601: public const TOLFAB = 20167;
5602: public const IPDTP_PORT = 20202;
5603: public const IPULSE_ICS = 20222;
5604: public const EMWAVEMSG = 20480;
5605: public const TRACK = 20670;
5606: public const ATHAND_MMP = 20999;
5607: public const IRTRANS = 21000;
5608: public const NOTEZILLA_LAN = 21010;
5609: public const TRINKET_AGENT = 21212;
5610: public const AIGAIRSERVER = 21221;
5611: public const RDM_TFS = 21553;
5612: public const DFSERVER = 21554;
5613: public const VOFR_GATEWAY = 21590;
5614: public const TVPM = 21800;
5615: public const WEBPHONE = 21845;
5616: public const NETSPEAK_IS = 21846;
5617: public const NETSPEAK_CS = 21847;
5618: public const NETSPEAK_ACD = 21848;
5619: public const NETSPEAK_CPS = 21849;
5620: public const SNAPENETIO = 22000;
5621: public const OPTOCONTROL = 22001;
5622: public const OPTOHOST002 = 22002;
5623: public const OPTOHOST003 = 22003;
5624: public const OPTOHOST004 = 22004;
5625: public const OPTOHOST004_2 = 22005;
5626: public const DCAP = 22125;
5627: public const GSIDCAP = 22128;
5628: public const EASYENGINE = 22222;
5629: public const WNN6 = 22273;
5630: public const CIS = 22305;
5631: public const SHREWD_CONTROL = 22335;
5632: public const CIS_SECURE = 22343;
5633: public const WIBUKEY = 22347;
5634: public const CODEMETER = 22350;
5635: public const CODEMETER_CMWAN = 22351;
5636: public const CALDSOFT_BACKUP = 22537;
5637: public const VOCALTEC_WCONF = 22555;
5638: public const TALIKASERVER = 22763;
5639: public const AWS_BRF = 22800;
5640: public const BRF_GW = 22951;
5641: public const INOVAPORT1 = 23000;
5642: public const INOVAPORT2 = 23001;
5643: public const INOVAPORT3 = 23002;
5644: public const INOVAPORT4 = 23003;
5645: public const INOVAPORT5 = 23004;
5646: public const INOVAPORT6 = 23005;
5647: public const GNTP = 23053;
5648: public const _5AFE_DIR = 23294;
5649: public const ELXMGMT = 23333;
5650: public const NOVAR_DBASE = 23400;
5651: public const NOVAR_ALARM = 23401;
5652: public const NOVAR_GLOBAL = 23402;
5653: public const AEQUUS = 23456;
5654: public const AEQUUS_ALT = 23457;
5655: public const AREAGUARD_NEO = 23546;
5656: public const MED_LTP = 24000;
5657: public const MED_FSP_RX = 24001;
5658: public const MED_FSP_TX = 24002;
5659: public const MED_SUPP = 24003;
5660: public const MED_OVW = 24004;
5661: public const MED_CI = 24005;
5662: public const MED_NET_SVC = 24006;
5663: public const FILESPHERE = 24242;
5664: public const VISTA_4GL = 24249;
5665: public const ILD = 24321;
5666: public const INTEL_RCI = 24386;
5667: public const TONIDODS = 24465;
5668: public const BINKP = 24554;
5669: public const BILOBIT = 24577;
5670: public const SDTVWCAM = 24666;
5671: public const CANDITV = 24676;
5672: public const FLASHFILER = 24677;
5673: public const PROACTIVATE = 24678;
5674: public const TCC_HTTP = 24680;
5675: public const CSLG = 24754;
5676: public const FIND = 24922;
5677: public const ICL_TWOBASE1 = 25000;
5678: public const ICL_TWOBASE2 = 25001;
5679: public const ICL_TWOBASE3 = 25002;
5680: public const ICL_TWOBASE4 = 25003;
5681: public const ICL_TWOBASE5 = 25004;
5682: public const ICL_TWOBASE6 = 25005;
5683: public const ICL_TWOBASE7 = 25006;
5684: public const ICL_TWOBASE8 = 25007;
5685: public const ICL_TWOBASE9 = 25008;
5686: public const ICL_TWOBASE10 = 25009;
5687: public const SAUTERDONGLE = 25576;
5688: public const IDTP = 25604;
5689: public const VOCALTEC_HOS = 25793;
5690: public const TASP_NET = 25900;
5691: public const NIOBSERVER = 25901;
5692: public const NILINKANALYST = 25902;
5693: public const NIPROBE = 25903;
5694: public const QUAKE = 26000;
5695: public const SCSCP = 26133;
5696: public const WNN6_DS = 26208;
5697: public const COCKROACH = 26257;
5698: public const EZPROXY = 26260;
5699: public const EZMEETING = 26261;
5700: public const K3SOFTWARE_SVR = 26262;
5701: public const K3SOFTWARE_CLI = 26263;
5702: public const EXOLINE_TCP = 26486;
5703: public const EXOCONFIG = 26487;
5704: public const EXONET = 26489;
5705: public const FLEX_LM = 27000;
5706: public const FLEX_LM_2 = 27001;
5707: public const FLEX_LM_3 = 27002;
5708: public const FLEX_LM_4 = 27003;
5709: public const FLEX_LM_5 = 27004;
5710: public const FLEX_LM_6 = 27005;
5711: public const FLEX_LM_7 = 27006;
5712: public const FLEX_LM_8 = 27007;
5713: public const FLEX_LM_9 = 27008;
5714: public const FLEX_LM_10 = 27009;
5715: public const IMAGEPUMP = 27345;
5716: public const JESMSJC = 27442;
5717: public const KOPEK_HTTPHEAD = 27504;
5718: public const ARS_VISTA = 27782;
5719: public const ASTROLINK = 27876;
5720: public const TW_AUTH_KEY = 27999;
5721: public const NXLMD = 28000;
5722: public const PQSP = 28001;
5723: public const VOXELSTORM = 28200;
5724: public const SIEMENSGSM = 28240;
5725: public const BOSSWAVE = 28589;
5726: public const OTMP = 29167;
5727: public const BINGBANG = 29999;
5728: public const NDMPS = 30000;
5729: public const PAGO_SERVICES1 = 30001;
5730: public const PAGO_SERVICES2 = 30002;
5731: public const AMICON_FPSU_RA = 30003;
5732: public const RWP = 30100;
5733: public const KINGDOMSONLINE = 30260;
5734: public const GS_REALTIME = 30400;
5735: public const OVOBS = 30999;
5736: public const KA_SDDP = 31016;
5737: public const AUTOTRAC_ACP = 31020;
5738: public const PACE_LICENSED = 31400;
5739: public const XQOSD = 31416;
5740: public const TETRINET = 31457;
5741: public const LM_MON = 31620;
5742: public const DSX_MONITOR = 31685;
5743: public const GAMESMITH_PORT = 31765;
5744: public const ICEEDCP_TX = 31948;
5745: public const ICEEDCP_RX = 31949;
5746: public const IRACINGHELPER = 32034;
5747: public const T1DISTPROC60 = 32249;
5748: public const PLEX = 32400;
5749: public const APM_LINK = 32483;
5750: public const SEC_NTB_CLNT = 32635;
5751: public const DMEXPRESS = 32636;
5752: public const FILENET_POWSRM = 32767;
5753: public const FILENET_TMS = 32768;
5754: public const FILENET_RPC = 32769;
5755: public const FILENET_NCH = 32770;
5756: public const FILENET_RMI = 32771;
5757: public const FILENET_PA = 32772;
5758: public const FILENET_CM = 32773;
5759: public const FILENET_RE = 32774;
5760: public const FILENET_PCH = 32775;
5761: public const FILENET_PEIOR = 32776;
5762: public const FILENET_OBROK = 32777;
5763: public const MLSN = 32801;
5764: public const RETP = 32811;
5765: public const IDMGRATM = 32896;
5766: public const MYSQLX = 33060;
5767: public const AURORA_BALAENA = 33123;
5768: public const DIAMONDPORT = 33331;
5769: public const DGI_SERV = 33333;
5770: public const SPEEDTRACE = 33334;
5771: public const TRACEROUTE = 33434;
5772: public const SNIP_SLAVE = 33656;
5773: public const TURBONOTE_2 = 34249;
5774: public const P_NET_LOCAL = 34378;
5775: public const P_NET_REMOTE = 34379;
5776: public const DHANALAKSHMI = 34567;
5777: public const PROFINET_RT = 34962;
5778: public const PROFINET_RTM = 34963;
5779: public const PROFINET_CM = 34964;
5780: public const ETHERCAT = 34980;
5781: public const HEATHVIEW = 35000;
5782: public const RT_VIEWER = 35001;
5783: public const RT_SOUND = 35002;
5784: public const RT_DEVICEMAPPER = 35003;
5785: public const RT_CLASSMANAGER = 35004;
5786: public const RT_LABTRACKER = 35005;
5787: public const RT_HELPER = 35006;
5788: public const AXIO_DISC = 35100;
5789: public const KITIM = 35354;
5790: public const ALTOVA_LM = 35355;
5791: public const GUTTERSNEX = 35356;
5792: public const OPENSTACK_ID = 35357;
5793: public const ALLPEERS = 36001;
5794: public const FEBOOTI_AW = 36524;
5795: public const OBSERVIUM_AGENT = 36602;
5796: public const MAPX = 36700;
5797: public const KASTENXPIPE = 36865;
5798: public const NECKAR = 37475;
5799: public const GDRIVE_SYNC = 37483;
5800: public const EFTP = 37601;
5801: public const UNISYS_EPORTAL = 37654;
5802: public const IVS_DATABASE = 38000;
5803: public const IVS_INSERTION = 38001;
5804: public const CRESCO_CONTROL = 38002;
5805: public const GALAXY7_DATA = 38201;
5806: public const FAIRVIEW = 38202;
5807: public const AGPOLICY = 38203;
5808: public const SRUTH = 38800;
5809: public const SECRMMSAFECOPYA = 38865;
5810: public const TURBONOTE_1 = 39681;
5811: public const SAFETYNETP = 40000;
5812: public const SPTX = 40404;
5813: public const CSCP = 40841;
5814: public const CSCCREDIR = 40842;
5815: public const CSCCFIREWALL = 40843;
5816: public const FS_QOS = 41111;
5817: public const TENTACLE = 41121;
5818: public const Z_WAVE_S = 41230;
5819: public const CRESTRON_CIP = 41794;
5820: public const CRESTRON_CTP = 41795;
5821: public const CRESTRON_CIPS = 41796;
5822: public const CRESTRON_CTPS = 41797;
5823: public const CANDP = 42508;
5824: public const CANDRP = 42509;
5825: public const CAERPC = 42510;
5826: public const RECVR_RC = 43000;
5827: public const REACHOUT = 43188;
5828: public const NDM_AGENT_PORT = 43189;
5829: public const IP_PROVISION = 43190;
5830: public const NOIT_TRANSPORT = 43191;
5831: public const SHAPERAI = 43210;
5832: public const EQ3_UPDATE = 43439;
5833: public const EW_MGMT = 43440;
5834: public const CISCOCSDB = 43441;
5835: public const Z_WAVE_TUNNEL = 44123;
5836: public const PMCD = 44321;
5837: public const PMCDPROXY = 44322;
5838: public const PMWEBAPI = 44323;
5839: public const COGNEX_DATAMAN = 44444;
5840: public const RBR_DEBUG = 44553;
5841: public const ETHERNET_IP_2 = 44818;
5842: public const M3DA = 44900;
5843: public const ASMP = 45000;
5844: public const ASMPS = 45001;
5845: public const RS_STATUS = 45002;
5846: public const SYNCTEST = 45045;
5847: public const INVISION_AG = 45054;
5848: public const CLOUDCHECK = 45514;
5849: public const EBA = 45678;
5850: public const DAI_SHELL = 45824;
5851: public const QDB2SERVICE = 45825;
5852: public const SSR_SERVERMGR = 45966;
5853: public const INEDO = 46336;
5854: public const SPREMOTETABLET = 46998;
5855: public const MEDIABOX = 46999;
5856: public const MBUS = 47000;
5857: public const WINRM = 47001;
5858: public const DBBROWSE = 47557;
5859: public const DIRECTPLAYSRVR = 47624;
5860: public const AP = 47806;
5861: public const BACNET = 47808;
5862: public const NIMCONTROLLER = 48000;
5863: public const NIMSPOOLER = 48001;
5864: public const NIMHUB = 48002;
5865: public const NIMGTW = 48003;
5866: public const NIMBUSDB = 48004;
5867: public const NIMBUSDBCTRL = 48005;
5868: public const _3GPP_CBSP = 48049;
5869: public const WEANDSF = 48050;
5870: public const ISNETSERV = 48128;
5871: public const BLP5 = 48129;
5872: public const COM_BARDAC_DW = 48556;
5873: public const IQOBJECT = 48619;
5874: public const ROBOTRACONTEUR = 48653;
5875: public const MATAHARI = 49000;
5876: public const NUSRP = 49001;
5877: public const INSPIDER = 49150;
5878:
5879: }
| 0 % | System\Sapi.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\System;
11:
12: use Dogma\Arr;
13:
14: class Sapi extends \Dogma\Enum\StringEnum
15: {
16:
17: public const AOL_SERVER = 'aolserver';
18: public const APACHE = 'apache';
19: public const APACHE_2_FILTER = 'apache2filter';
20: public const APACHE_2_HANDLER = 'apache2handler';
21: public const CAUDIUM = 'caudium';
22: public const CGI = 'cgi'; // (until PHP 5.3)
23: public const CGI_FCGI = 'cgi-fcgi';
24: public const CLI = 'cli';
25: public const CLI_SERVER = 'cli-server';
26: public const CONTINUITY = 'continuity';
27: public const EMBED = 'embed';
28: public const FPM_FCGI = 'fpm-fcgi';
29: public const ISAPI = 'isapi';
30: public const LITESPEED = 'litespeed';
31: public const MILTER = 'milter';
32: public const NSAPI = 'nsapi';
33: public const PHTTPD = 'phttpd';
34: public const PI3WEB = 'pi3web';
35: public const ROXEN = 'roxen';
36: public const THTTPD = 'thttpd';
37: public const TUX = 'tux';
38: public const WEBJAMES = 'webjames';
39:
40: /** @var string[] */
41: private static $multithreaded = [
42: self::AOL_SERVER,
43: self::APACHE,
44: self::APACHE_2_FILTER,
45: self::APACHE_2_HANDLER,
46: self::CAUDIUM,
47: self::CONTINUITY,
48: self::ISAPI,
49: self::LITESPEED,
50: self::MILTER,
51: self::NSAPI,
52: self::PHTTPD,
53: self::PI3WEB,
54: self::ROXEN,
55: self::THTTPD,
56: self::TUX,
57: self::WEBJAMES,
58: ];
59:
60: public function isMultithreaded(): bool
61: {
62: return Arr::contains(self::$multithreaded, $this->getValue());
63: }
64:
65: }
| 73 % | Tester\Assert.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Tester;
11:
12: use Dogma\Equalable;
13:
14: /**
15: * Tester\Assert with fixed order of parameters
16: * Added support for comparing object with Equalable interface
17: */
18: class Assert extends \Tester\Assert
19: {
20:
21: /**
22: * @param mixed $actual
23: * @param mixed $expected
24: * @param string|mixed|null $description
25: */
26: public static function same($actual, $expected, $description = null): void
27: {
28: parent::same($expected, $actual, $description);
29: }
30:
31: /**
32: * @param mixed $actual
33: * @param mixed $expected
34: * @param string|mixed|null $description
35: */
36: public static function notSame($actual, $expected, $description = null): void
37: {
38: parent::notSame($expected, $actual, $description);
39: }
40:
41: /**
42: * Added support for comparing object with Equalable interface
43: * @param mixed $actual
44: * @param mixed $expected
45: * @param string|mixed|null $description
46: */
47: public static function equal($actual, $expected, $description = null): void
48: {
49: if ($actual instanceof Equalable && $expected instanceof Equalable && get_class($actual) === get_class($expected)) {
50: self::true($actual->equals($expected));
51: } else {
52: self::$counter++;
53: if (!self::isEqual($expected, $actual)) {
54: self::fail(self::describe('%1 should be equal to %2', $description), $actual, $expected);
55: }
56: }
57: }
58:
59: /**
60: * Added support for comparing object with Equalable interface
61: * @param mixed $actual
62: * @param mixed $expected
63: * @param string|mixed|null $description
64: */
65: public static function notEqual($actual, $expected, $description = null): void
66: {
67: if ($actual instanceof Equalable && $expected instanceof Equalable && get_class($actual) === get_class($expected)) {
68: self::false($actual->equals($expected));
69: } else {
70: self::$counter++;
71: if (self::isEqual($expected, $actual)) {
72: self::fail(self::describe('%1 should not be equal to %2', $description), $actual, $expected);
73: }
74: }
75: }
76:
77: /**
78: * @param mixed $haystack
79: * @param mixed $needle
80: * @param string|mixed|null $description
81: */
82: public static function contains($haystack, $needle, $description = null): void
83: {
84: parent::contains($needle, $haystack, $description);
85: }
86:
87: /**
88: * @param mixed $haystack
89: * @param mixed $needle
90: * @param string|mixed|null $description
91: */
92: public static function notContains($haystack, $needle, $description = null): void
93: {
94: parent::notContains($needle, $haystack, $description);
95: }
96:
97: /**
98: * @param mixed $actualValue
99: * @param int|mixed $expectedCount
100: * @param string|mixed|null $description
101: */
102: public static function count($actualValue, $expectedCount, $description = null): void
103: {
104: parent::count($expectedCount, $actualValue, $description);
105: }
106:
107: /**
108: * @param mixed $actualValue
109: * @param string|mixed $expectedType
110: * @param string|mixed|null $description
111: */
112: public static function type($actualValue, $expectedType, $description = null): void
113: {
114: parent::type($expectedType, $actualValue, $description);
115: }
116:
117: /**
118: * @param mixed $actualValue
119: * @param string|mixed $mask
120: * @param string|mixed|null $description
121: */
122: public static function match($actualValue, $mask, $description = null): void
123: {
124: parent::match($mask, $actualValue, $description);
125: }
126:
127: /**
128: * @param mixed $actualValue
129: * @param mixed $file
130: * @param string|mixed|null $description
131: */
132: public static function matchFile($actualValue, $file, $description = null): void
133: {
134: parent::matchFile($file, $actualValue, $description);
135: }
136:
137: /**
138: * @param string|mixed $message
139: * @param mixed|null $actual
140: * @param mixed|null $expected
141: */
142: public static function fail($message, $actual = null, $expected = null): void
143: {
144: parent::fail($message, $expected, $actual);
145: }
146:
147: /**
148: * Added support for comparing object with Equalable interface
149: * @return bool
150: * @internal
151: */
152: public static function isEqual($expected, $actual, $level = 0, $objects = NULL)
153: {
154: if ($level > 10) {
155: throw new \Exception('Nesting level too deep or recursive dependency.');
156: }
157:
158: if (is_float($expected) && is_float($actual) && is_finite($expected) && is_finite($actual)) {
159: $diff = abs($expected - $actual);
160: return ($diff < self::EPSILON) || ($diff / max(abs($expected), abs($actual)) < self::EPSILON);
161: }
162:
163: if (is_object($expected) && is_object($actual) && get_class($expected) === get_class($actual)) {
164: /* start */
165: if ($expected instanceof Equalable && $actual instanceof Equalable) {
166: return $expected->equals($actual);
167: }
168: /* end */
169: $objects = $objects ? clone $objects : new \SplObjectStorage;
170: if (isset($objects[$expected])) {
171: return $objects[$expected] === $actual;
172: } elseif ($expected === $actual) {
173: return TRUE;
174: }
175: $objects[$expected] = $actual;
176: $objects[$actual] = $expected;
177: $expected = (array) $expected;
178: $actual = (array) $actual;
179: }
180:
181: if (is_array($expected) && is_array($actual)) {
182: ksort($expected, SORT_STRING);
183: ksort($actual, SORT_STRING);
184: if (array_keys($expected) !== array_keys($actual)) {
185: return FALSE;
186: }
187:
188: foreach ($expected as $value) {
189: if (!self::isEqual($value, current($actual), $level + 1, $objects)) {
190: return FALSE;
191: }
192: next($actual);
193: }
194: return TRUE;
195: }
196:
197: return $expected === $actual;
198: }
199:
200: private static function describe($reason, $description)
201: {
202: return ($description ? $description . ': ' : '') . $reason;
203: }
204:
205: }
| 96 % | Time\Date.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time;
11:
12: use Dogma\Arr;
13: use Dogma\Check;
14: use Dogma\Comparable;
15: use Dogma\Equalable;
16: use Dogma\Order;
17: use Dogma\Time\Provider\TimeProvider;
18: use Dogma\Type;
19:
20: /**
21: * Date class.
22: */
23: class Date implements \Dogma\NonIterable, \Dogma\Equalable, \Dogma\Comparable
24: {
25: use \Dogma\StrictBehaviorMixin;
26: use \Dogma\NonIterableMixin;
27:
28: public const MIN = '0001-01-01';
29: public const MAX = '9999-12-31';
30:
31: public const MIN_DAY_NUMBER = 0;
32: public const MAX_DAY_NUMBER = 3652058;
33:
34: public const DEFAULT_FORMAT = 'Y-m-d';
35:
36: /** @var int */
37: private $dayNumber;
38:
39: /** @var \DateTimeImmutable|null */
40: private $dateTime;
41:
42: /**
43: * @param string|int $date
44: */
45: public function __construct($date = 'today')
46: {
47: if (is_int($date)) {
48: Check::range($date, self::MIN_DAY_NUMBER, self::MAX_DAY_NUMBER);
49: $this->dayNumber = $date;
50: } else {
51: try {
52: $this->dateTime = (new \DateTimeImmutable($date))->setTime(0, 0, 0);
53: $this->dayNumber = self::calculateDayNumber($this->dateTime);
54: } catch (\Throwable $e) {
55: throw new \Dogma\Time\InvalidDateTimeException($date, $e);
56: }
57: }
58: }
59:
60: public static function createFromTimestamp(int $timestamp): Date
61: {
62: return DateTime::createFromTimestamp($timestamp)->getDate();
63: }
64:
65: public static function createFromDateTimeInterface(\DateTimeInterface $dateTime): Date
66: {
67: if ($dateTime instanceof DateTime) {
68: return $dateTime->getDate();
69: } else {
70: return DateTime::createFromDateTimeInterface($dateTime)->getDate();
71: }
72: }
73:
74: public static function createFromComponents(int $year, int $month, int $day): self
75: {
76: Check::range($year, 1, 9999);
77: Check::range($month, 1, 12);
78: Check::range($day, 1, 31);
79:
80: return new static(sprintf('%d-%d-%d 00:00:00', $year, $month, $day));
81: }
82:
83: public static function createFromDayNumber(int $dayNumber): self
84: {
85: return new static($dayNumber);
86: }
87:
88: final public function __clone()
89: {
90: $this->dateTime = null;
91: }
92:
93: private function getDateTime(): \DateTimeImmutable
94: {
95: if ($this->dateTime === null) {
96: $this->dateTime = new \DateTimeImmutable(self::MIN . ' +' . $this->dayNumber . ' days');
97: }
98:
99: return $this->dateTime;
100: }
101:
102: public function modify(string $value): self
103: {
104: return static::createFromDateTimeInterface($this->getDateTime()->modify($value));
105: }
106:
107: public function format(string $format = self::DEFAULT_FORMAT, ?DateTimeFormatter $formatter = null): string
108: {
109: if ($formatter === null) {
110: return $this->getDateTime()->format($format);
111: } else {
112: return $formatter->format($this, $format);
113: }
114: }
115:
116: public function toDateTime(?\DateTimeZone $timeZone = null): DateTime
117: {
118: return DateTime::createFromDateAndTime($this, new Time(0), $timeZone);
119: }
120:
121: public function getDayNumber(): int
122: {
123: return $this->dayNumber;
124: }
125:
126: /**
127: * Returns number of day since 0001-01-01 (day 0)
128: * @return int
129: */
130: public static function calculateDayNumber(\DateTimeInterface $dateTime): int
131: {
132: $start = new \DateTimeImmutable(self::MIN . ' 00:00:00');
133: $diff = $dateTime->diff($start, true);
134:
135: return $diff->days;
136: }
137:
138: public function increment(): self
139: {
140: return new static($this->dayNumber + 1);
141: }
142:
143: public function decrement(): self
144: {
145: return new static($this->dayNumber - 1);
146: }
147:
148: /**
149: * @param \DateTimeInterface|\Dogma\Time\Date $date
150: * @param bool $absolute
151: * @return \DateInterval|bool
152: */
153: public function diff($date, bool $absolute = false)
154: {
155: Check::types($date, [\DateTimeInterface::class, self::class]);
156:
157: return (new \DateTime($this->format()))->diff(new \DateTime($date->format(self::DEFAULT_FORMAT)), $absolute);
158: }
159:
160: public function getStart(?\DateTimeZone $timeZone = null): DateTime
161: {
162: return (new DateTime($this->format(), $timeZone))->setTime(0, 0, 0);
163: }
164:
165: public function getStartFormatted(?string $format = null, ?\DateTimeZone $timeZone = null): string
166: {
167: return $this->getStart($timeZone)->format($format ?? DateTime::DEFAULT_FORMAT);
168: }
169:
170: public function getEnd(?\DateTimeZone $timeZone = null): DateTime
171: {
172: return (new DateTime($this->format(), $timeZone))->setTime(23, 59, 59);
173: }
174:
175: public function getEndFormatted(?string $format = null, ?\DateTimeZone $timeZone = null): string
176: {
177: return $this->getStart($timeZone)->setTime(23, 59, 59)->format($format ?? DateTime::DEFAULT_FORMAT);
178: }
179:
180: public function compare(Comparable $other): int
181: {
182: $other instanceof self or Check::object($other, self::class);
183:
184: return $this->dayNumber <=> $other->dayNumber;
185: }
186:
187: public function equals(Equalable $other): bool
188: {
189: $other instanceof self or Check::object($other, self::class);
190:
191: return $this->dayNumber === $other->dayNumber;
192: }
193:
194: public function isBefore(Date $date): bool
195: {
196: return $this->dayNumber < $date->dayNumber;
197: }
198:
199: public function isAfter(Date $date): bool
200: {
201: return $this->dayNumber > $date->dayNumber;
202: }
203:
204: public function isSameOrBefore(Date $date): bool
205: {
206: return $this->dayNumber <= $date->dayNumber;
207: }
208:
209: public function isSameOrAfter(Date $date): bool
210: {
211: return $this->dayNumber >= $date->dayNumber;
212: }
213:
214: public function isBetween(Date $sinceDate, Date $untilDate): bool
215: {
216: return $this->dayNumber >= $sinceDate->dayNumber && $this->dayNumber <= $untilDate->dayNumber;
217: }
218:
219: public function isFuture(?TimeProvider $timeProvider = null): bool
220: {
221: $today = $timeProvider !== null ? $timeProvider->getDate() : new Date();
222:
223: return $this->dayNumber > $today->dayNumber;
224: }
225:
226: public function isPast(?TimeProvider $timeProvider = null): bool
227: {
228: $today = $timeProvider !== null ? $timeProvider->getDate() : new Date();
229:
230: return $this->dayNumber < $today->dayNumber;
231: }
232:
233: public function getDayOfWeekEnum(): DayOfWeek
234: {
235: return DayOfWeek::get(($this->dayNumber % 7) + 1);
236: }
237:
238: /**
239: * @param int|\Dogma\Time\DayOfWeek $day
240: * @return bool
241: */
242: public function isDayOfWeek($day): bool
243: {
244: Check::types($day, [Type::INT, DayOfWeek::class]);
245:
246: if (is_int($day)) {
247: $day = DayOfWeek::get($day);
248: }
249:
250: return (($this->dayNumber % 7) + 1) === $day->getValue();
251: }
252:
253: public function isWeekend(): bool
254: {
255: return (($this->dayNumber % 7) + 1) > DayOfWeek::FRIDAY;
256: }
257:
258: public function getMonthEnum(): Month
259: {
260: return Month::get((int) $this->format('n'));
261: }
262:
263: /**
264: * @param int|\Dogma\Time\Month $month
265: * @return bool
266: */
267: public function isMonth($month): bool
268: {
269: Check::types($month, [Type::INT, Month::class]);
270:
271: if (is_int($month)) {
272: $month = Month::get($month);
273: }
274:
275: return (int) $this->format('n') === $month->getValue();
276: }
277:
278: public static function min(self ...$items): self
279: {
280: return Arr::minBy($items, function (self $date) {
281: return $date->dayNumber;
282: });
283: }
284:
285: public static function max(self ...$items): self
286: {
287: return Arr::maxBy($items, function (self $date) {
288: return $date->dayNumber;
289: });
290: }
291:
292: /**
293: * @param \Dogma\Time\Date[] $items
294: * @param int $flags
295: * @return \Dogma\Time\Date[]
296: */
297: public static function sort(array $items, int $flags = Order::ASCENDING): array
298: {
299: return Arr::sortWith($items, function (Date $a, Date $b) {
300: return $a->dayNumber <=> $b->dayNumber;
301: }, $flags);
302: }
303:
304: }
| 67 % | Time\DateTime.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time;
11:
12: use Dogma\Check;
13: use Dogma\Comparable;
14: use Dogma\Equalable;
15: use Dogma\Str;
16: use Dogma\Time\Interval\DateTimeInterval;
17: use Dogma\Time\Provider\TimeProvider;
18: use Dogma\Type;
19:
20: /**
21: * Immutable date and time class
22: */
23: class DateTime extends \DateTimeImmutable implements \Dogma\NonIterable, \DateTimeInterface, \Dogma\Equalable, \Dogma\Comparable
24: {
25: use \Dogma\StrictBehaviorMixin;
26: use \Dogma\NonIterableMixin;
27:
28: public const MIN = '0001-01-01 00:00:00.000000';
29: public const MAX = '9999-12-31 23:59:59.999999';
30:
31: public const DEFAULT_FORMAT = 'Y-m-d H:i:s';
32: public const FORMAT_EMAIL_HTTP = DATE_RFC2822;
33:
34: /**
35: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
36: * @param string $format
37: * @param string $timeString
38: * @param \DateTimeZone|null $timeZone
39: * @return \Dogma\Time\DateTime
40: */
41: public static function createFromFormat($format, $timeString, $timeZone = null): self
42: {
43: // due to invalid typehint in parent class...
44: Check::nullableObject($timeZone, \DateTimeZone::class);
45:
46: // due to invalid optional arguments handling...
47: if ($timeZone === null) {
48: $dateTime = parent::createFromFormat($format, $timeString);
49: } else {
50: $dateTime = parent::createFromFormat($format, $timeString, $timeZone);
51: }
52:
53: return new static($dateTime->format(self::DEFAULT_FORMAT), $timeZone ?? $dateTime->getTimezone());
54: }
55:
56: public static function createFromTimestamp(int $timestamp, ?\DateTimeZone $timeZone = null): self
57: {
58: return static::createFromFormat('U', (string) $timestamp, $timeZone);
59: }
60:
61: public static function createFromDateTimeInterface(\DateTimeInterface $dateTime, ?\DateTimeZone $timeZone = null): self
62: {
63: if ($timeZone === null) {
64: $timeZone = $dateTime->getTimezone();
65: }
66: return new static($dateTime->format(self::DEFAULT_FORMAT), $timeZone);
67: }
68:
69: public static function createFromDateAndTime(Date $date, Time $time, ?\DateTimeZone $timeZone = null): self
70: {
71: return new static($date->format(Date::DEFAULT_FORMAT) . ' ' . $time->format(Time::DEFAULT_FORMAT), $timeZone);
72: }
73:
74: /**
75: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
76: * @param string $modify
77: * @return static
78: */
79: public function modify($modify): self
80: {
81: return new static(parent::modify($modify));
82: }
83:
84: /**
85: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
86: * @param \DateInterval|\Dogma\Time\Interval\DateOrTimeInterval $interval
87: * @return self
88: */
89: public function add($interval): self
90: {
91: if ($interval instanceof \DateInterval) {
92: $that = parent::add($interval);
93: } elseif (!$interval->isMixed()) {
94: $interval = $interval->toNative();
95: $that = parent::add($interval);
96: } else {
97: [$positive, $negative] = $interval->toPositiveNegative();
98: $that = parent::add($positive)->add($negative);
99: }
100:
101: return static::createFromDateTimeInterface($that);
102: }
103:
104: /**
105: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
106: * @param \DateInterval|\Dogma\Time\Interval\DateOrTimeInterval $interval
107: * @return self
108: */
109: public function sub($interval): self
110: {
111: if ($interval instanceof DateTimeInterval) {
112: return $this->add($interval->invert());
113: }
114: $that = parent::sub($interval);
115:
116: return static::createFromDateTimeInterface($that);
117: }
118:
119: /**
120: * @param \DateTimeInterface $other
121: * @param bool $absolute
122: * @return \Dogma\Time\Interval\DateTimeInterval
123: */
124: public function diffInterval(\DateTimeInterface $other, bool $absolute = false): DateTimeInterval
125: {
126: $interval = parent::diff($other, $absolute);
127:
128: return DateTimeInterval::createFromDateInterval($interval);
129: }
130:
131: /**
132: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
133: * @param string $format
134: * @return string
135: */
136: public function format($format = self::DEFAULT_FORMAT, ?DateTimeFormatter $formatter = null): string
137: {
138: if ($formatter === null) {
139: return parent::format($format);
140: } else {
141: return $formatter->format($this, $format);
142: }
143: }
144:
145: public function getDate(): Date
146: {
147: return new Date($this->format(Date::DEFAULT_FORMAT));
148: }
149:
150: public function getTime(): Time
151: {
152: return new Time($this->format(Time::DEFAULT_FORMAT));
153: }
154:
155: /**
156: * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
157: * @param \Dogma\Time\Time|int|string $time
158: * @param int|null $minutes
159: * @param int|null $seconds
160: * @param int|null $microseconds
161: * @return self
162: */
163: public function setTime($time, $minutes = null, $seconds = null, $microseconds = null): self
164: {
165: if ($time instanceof Time) {
166: return self::createFromDateTimeInterface(parent::setTime($time->getHours(), $time->getMinutes(), $time->getSeconds()));
167: }
168: if ($minutes === null && $seconds === null && is_string($time) && Str::contains($time, ':')) {
169: @list($time, $minutes, $seconds) = explode(':', $time);
170: if (Str::contains($seconds, '.')) {
171: @list($seconds, $microseconds) = explode('.', $seconds);
172: $microseconds = (int) (('0.' . $microseconds) * 1000000);
173: }
174: }
175:
176: return self::createFromDateTimeInterface(parent::setTime((int) $time, (int) $minutes, (int) $seconds, (int) $microseconds));
177: }
178:
179: public function compare(Comparable $other): int
180: {
181: $other instanceof self or Check::object($other, self::class);
182:
183: return $this > $other ? 1 : ($other > $this ? -1 : 0);
184: }
185:
186: public function equals(Equalable $other): bool
187: {
188: $other instanceof self or Check::object($other, self::class);
189:
190: return $this->getTimestamp() === $other->getTimestamp() && $this->format('u') === $other->format('u');
191: }
192:
193: public function equalsUpTo(\DateTimeInterface $other, DateTimeUnit $unit): bool
194: {
195: $format = $unit->getComparisonFormat();
196: $formatter = new DateTimeFormatter();
197:
198: return $formatter->format($this, $format) === $formatter->format($other, $format);
199: }
200:
201: public function isBefore(\DateTimeInterface $dateTime): bool
202: {
203: return $this < $dateTime;
204: }
205:
206: public function isAfter(\DateTimeInterface $dateTime): bool
207: {
208: return $this > $dateTime;
209: }
210:
211: public function isBetween(\DateTimeInterface $sinceTime, \DateTimeInterface $untilTime): bool
212: {
213: return $this >= $sinceTime && $this <= $untilTime;
214: }
215:
216: public function isFuture(?TimeProvider $timeProvider = null): bool
217: {
218: return $this > ($timeProvider !== null ? $timeProvider->getDateTime() : new self());
219: }
220:
221: public function isPast(?TimeProvider $timeProvider = null): bool
222: {
223: return $this < ($timeProvider !== null ? $timeProvider->getDateTime() : new self());
224: }
225:
226: /**
227: * @param \DateTimeInterface|\Dogma\Time\Date $date
228: * @return bool
229: */
230: public function isSameDay($date): bool
231: {
232: Check::types($date, [\DateTimeInterface::class, Date::class]);
233:
234: return $this->format(Date::DEFAULT_FORMAT) === $date->format(Date::DEFAULT_FORMAT);
235: }
236:
237: /**
238: * @param \DateTimeInterface|\Dogma\Time\Date $date
239: * @return bool
240: */
241: public function isBeforeDay($date): bool
242: {
243: Check::types($date, [\DateTimeInterface::class, Date::class]);
244:
245: return $this->format(Date::DEFAULT_FORMAT) < $date->format(Date::DEFAULT_FORMAT);
246: }
247:
248: /**
249: * @param \DateTimeInterface|\Dogma\Time\Date $date
250: * @return bool
251: */
252: public function isAfterDay($date): bool
253: {
254: Check::types($date, [\DateTimeInterface::class, Date::class]);
255:
256: return $this->format(Date::DEFAULT_FORMAT) > $date->format(Date::DEFAULT_FORMAT);
257: }
258:
259: /**
260: * @param \DateTimeInterface|\Dogma\Time\Date $sinceDate
261: * @param \DateTimeInterface|\Dogma\Time\Date $untilDate
262: * @return bool
263: */
264: public function isBetweenDays($sinceDate, $untilDate): bool
265: {
266: Check::types($sinceDate, [\DateTimeInterface::class, Date::class]);
267: Check::types($untilDate, [\DateTimeInterface::class, Date::class]);
268:
269: $thisDate = $this->format(Date::DEFAULT_FORMAT);
270:
271: return $thisDate >= $sinceDate->format(Date::DEFAULT_FORMAT)
272: && $thisDate <= $untilDate->format(Date::DEFAULT_FORMAT);
273: }
274:
275: public function isToday(?TimeProvider $timeProvider = null): bool
276: {
277: $today = $timeProvider !== null ? $timeProvider->getDate() : new Date('today');
278:
279: return $this->isBetween($today->getStart(), $today->getEnd());
280: }
281:
282: public function isYesterday(?TimeProvider $timeProvider = null): bool
283: {
284: $yesterday = $timeProvider !== null ? $timeProvider->getDateTime()->modify('-1 day')->getDate() : new Date('yesterday');
285:
286: return $this->isBetween($yesterday->getStart(), $yesterday->getEnd());
287: }
288:
289: public function isTomorrow(?TimeProvider $timeProvider = null): bool
290: {
291: $tomorrow = $timeProvider !== null ? $timeProvider->getDateTime()->modify('+1 day')->getDate() : new Date('tomorrow');
292:
293: return $this->isBetween($tomorrow->getStart(), $tomorrow->getEnd());
294: }
295:
296: public function getDayOfWeekEnum(): DayOfWeek
297: {
298: return DayOfWeek::get((int) $this->format('N'));
299: }
300:
301: /**
302: * @param int|\Dogma\Time\DayOfWeek $day
303: * @return bool
304: */
305: public function isDayOfWeek($day): bool
306: {
307: Check::types($day, [Type::INT, DayOfWeek::class]);
308:
309: if (is_int($day)) {
310: $day = DayOfWeek::get($day);
311: }
312:
313: return (int) $this->format('N') === $day->getValue();
314: }
315:
316: public function isWeekend(): bool
317: {
318: return $this->format('N') > 5;
319: }
320:
321: public function getMonthEnum(): Month
322: {
323: return Month::get((int) $this->format('n'));
324: }
325:
326: /**
327: * @param int|\Dogma\Time\Month $month
328: * @return bool
329: */
330: public function isMonth($month): bool
331: {
332: Check::types($month, [Type::INT, Month::class]);
333:
334: if (is_int($month)) {
335: $month = Month::get($month);
336: }
337:
338: return (int) $this->format('n') === $month->getValue();
339: }
340:
341: }
| 80 % | Time\DateTimeFormatter.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time;
11:
12: use Dogma\Language\Localization\Translator;
13: use Dogma\Time\Provider\CurrentTimeProvider;
14: use Dogma\Time\Provider\TimeProvider;
15:
16: class DateTimeFormatter
17: {
18: use \Dogma\StrictBehaviorMixin;
19:
20: public const YEAR = 'Y'; // Y
21: public const YEAR_SHORT = 'y'; // y
22: public const DAY_OF_YEAR = 'Z'; // --
23: public const DAY_OF_YEAR_INDEX = 'z'; // z
24: public const LEAP_YEAR = 'r'; // L
25: public const QUARTER = 'Q';
26:
27: public const MONTH_LZ = 'M'; // m
28: public const MONTH = 'm'; // n
29: public const MONTH_NAME = 'N'; // F
30: public const MONTH_NAME_SHORT = 'n'; // M
31: public const DAYS_IN_MONTH = 'k'; // t
32:
33: public const WEEK_OF_YEAR = 'W'; // W
34: public const ISO_WEEK_YEAR = 'w'; // o
35: public const DAY_OF_WEEK = 'B'; // N
36: public const DAY_OF_WEEK_INDEX = 'b'; // w
37: public const DAY_OF_WEEK_NAME = 'C'; // l
38: public const DAY_OF_WEEK_NAME_SHORT = 'c';
39:
40: public const DAY_LZ = 'D'; // d
41: public const DAY = 'd'; // j
42: public const DAY_SUFFIX = 'e'; // S
43:
44: public const HOURS_LZ = 'H'; // H
45: public const HOURS = 'h'; // G
46: public const HOURS_12_LZ = 'G'; // h
47: public const HOURS_12 = 'g'; // g
48: public const AM_PM_UPPER = 'A'; // A
49: public const AM_PM_LOWER = 'a'; // a
50:
51: public const MINUTES_LZ = 'I'; // i
52: public const MINUTES = 'i'; // --
53: public const SECONDS_LZ = 'S'; // s
54: public const SECONDS = 's'; // --
55: public const MILISECONDS_LZ = 'V'; // v
56: public const MILISECONDS = 'v'; // --
57: public const MICROSECONDS_LZ = 'U'; // u
58: public const MICROSECONDS = 'u'; // --
59:
60: public const TIMEZONE_NAME = 'T'; // e
61: public const TIMEZONE_NAME_SHORT = 't'; // T
62: public const TIMEZONE_OFFSET_COLON = 'O'; // P
63: public const TIMEZONE_OFFSET = 'o'; // P
64: public const TIMEZONE_OFFSET_SECONDS = 'P'; // Z
65: public const DAYLIGHT_SAVING_TIME = 'p'; // I
66:
67: public const FORMAT_DEFAULT = 'Y-M-D H:I:S';
68: public const FORMAT_ISO_TZ = 'Y-M-D%TH:I:SO';
69: public const FORMAT_ISO_MICRO_TZ = 'Y-M-D%TH:I:S.UO';
70:
71: private const MONTH_LENGTHS = [
72: 1 => 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
73: ];
74:
75: /** @var \Dogma\Localization\Translator|null */
76: private $translator;
77:
78: /** @var \Dogma\Time\Provider\TimeProvider */
79: private $timeProvider;
80:
81: public function __construct(?Translator $translator = null, ?TimeProvider $timeProvider = null)
82: {
83: $this->translator = $translator;
84: $this->timeProvider = $timeProvider ?? new CurrentTimeProvider();
85: }
86:
87: /**
88: * Letter assignment:
89: * am dow day - - hour min - - L month ofs q - s tz µs ms w year_
90: * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
91: *
92: * Use "[" and "]" for optional groups. Group containing a value of zero will not be part of output. Eg:
93: * - "[m O, ]d F" will print "5 months, 10 days" or "10 days" if months are 0.
94: * - "[m O, d F, ]h l" will print "0 months, 5 days, 2 hours" because both values inside group must be 0 to skip group.
95: *
96: * Ch. Nt. Description Applicable to
97: * ---- --- ----------------------------------- -------------
98: * Escaping:
99: * % % Escape character. Use %% for printing "%"
100: *
101: * Skip groups:
102: * [ - Group start, skip if zero
103: * ] - Group end, skip if zero
104: * ( - Group start, skip if same as now
105: * ) - Group end, skip if same as now
106: *
107: * Modifiers:
108: * ^ - Upper case letters "FRIDAY"
109: * ! - Starts with upper case letter "Friday"
110: * = - "At" case, eg. "C=" --> "at friday", "v pátek"
111: * > - "Since" case, eg. "C>" --> "since friday", "od pátku"
112: * < - "Until" case, eg. "C<" --> "until friday", "do pátku"
113: * * - "Of" case for names and ordinal suffix for numbers
114: * - eg. "d* N*" --> "27th of april", "27. dubna"
115: * - eg. "N d*" --> "april 27th", "duben 27."
116: *
117: * Objects:
118: * Y Y Year, 4 digits d, dt
119: * y y Year, 2 digits d, dt
120: * Z - Day of the year (1-366) d, dt
121: * z z Day of the year (0-365) d, dt
122: * Q - Quarter (1-4) d, dt
123: * r L Leap year (0/1) d, dt
124: *
125: * M m Month number with leading zeros d, dt
126: * m n Month number d, dt
127: * N F Month name d, dt
128: * n M Month name short d, dt
129: * k t Number of days in month d, dt
130: *
131: * W W Week of year (ISO) d, dt
132: * w o Year of week (ISO) d, dt
133: * B N Day of week number (ISO, 1-7) d, dt
134: * b w Day of week index (0-6) d, dt
135: * C l Day of week name d, dt
136: * c D Day of week name short d, dt
137: *
138: * D d Day of month with leading zeros d, dt
139: * d j Day of month d, dt
140: *
141: * H H Hours (24) with leading zeros dt, t
142: * h G Hours (24) dt, t
143: * G h Hours (12) with leading zeros dt, t
144: * g g Hours (12) dt, t
145: * A A AM/PM dt, t
146: * a a am/pm dt, t
147: *
148: * I i Minutes with leading zeros dt, t
149: * i - Minutes dt, t
150: * S s Seconds with leading zeros dt, t
151: * s - Seconds dt, t
152: * V v Miliseconds with leading zeros dt, t
153: * v - Miliseconds dt, t
154: * U u Microseconds with leading zeros dt, t
155: * u - Microseconds dt, t
156: *
157: * T e Timezone name dt
158: * t T Timezone abbreviation dt
159: * O P Timezone offset with ":" ("01:00") dt
160: * o O Timezone offset ("0000") dt
161: * P Z Timezone offset in seconds dt
162: * p I Daylight saving time (0/1) dt
163: *
164: * @param \DateTimeInterface|\Dogma\Time\Date|\Dogma\Time\Time $dateTime
165: * @param string|null $format
166: * @return string
167: */
168: public function format($dateTime, ?string $format = null): string
169: {
170: if ($this->translator === null) {
171: $nativeFormat = $this->getNativeFormat($format);
172: if ($nativeFormat !== null) {
173: // faster
174: return $dateTime->format($nativeFormat);
175: }
176: }
177:
178: ///
179: }
180:
181: /**
182: * @param string $format
183: * @return string|null
184: */
185: private function getNativeFormat(string $format): ?string
186: {
187: $from = '{}[]()ZQrMmNnLkwBbCcFDdefGIiSsVvUuTtOoPp';
188: $to = '00000000LmnfM0toNwlD0djSGhi0s000u0eTPOZI';
189:
190: $format = strtr($format, $from, strtr($to, '0', "\n"));
191: if (strstr($format, "\0") === false) {
192: return $format;
193: } else {
194: return null;
195: }
196: }
197:
198: private function isLeapYear(int $year): bool
199: {
200: return ($year % 4) && (!($year % 100) || ($year % 400));
201: }
202:
203: /**
204: * @return string[]
205: */
206: protected function getMonths(): array
207: {
208: return Month::getNames();
209: }
210:
211: /**
212: * @return string[]
213: */
214: protected function getDaysOfWeek(): array
215: {
216: return DayOfWeek::getNames();
217: }
218:
219: }
| 0 % | Time\DateTimeUnit.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Time;
4:
5: class DateTimeUnit extends \Dogma\Enum\StringEnum
6: {
7:
8: public const YEAR = 'year';
9: public const MONTH = 'month';
10: public const WEEK = 'week';
11: public const DAY = 'day';
12:
13: public const HOUR = 'hour';
14: public const MINUTE = 'minute';
15: public const SECOND = 'second';
16: public const MILISECOND = 'milisecond';
17: public const MICROSECOND = 'microsecond';
18:
19: /**
20: * @return string[]
21: */
22: public static function getDateUnits(): array
23: {
24: return [
25: self::YEAR,
26: self::MONTH,
27: self::WEEK,
28: self::DAY,
29: ];
30: }
31:
32: /**
33: * @return string[]
34: */
35: public static function getTimeUnits(): array
36: {
37: return [
38: self::HOUR,
39: self::MINUTE,
40: self::SECOND,
41: self::MILISECOND,
42: self::MICROSECOND,
43: ];
44: }
45:
46: /**
47: * @return string[]
48: */
49: public static function getComparisonFormats(): array
50: {
51: return [
52: self::YEAR => 'Y',
53: self::MONTH => 'Ym',
54: self::WEEK => 'oW',
55: self::DAY => 'Ymd',
56: self::HOUR => 'YmdH',
57: self::MINUTE => 'YmdHi',
58: self::SECOND => 'YmdHis',
59: self::MILISECOND => 'YmdHisv',
60: self::MICROSECOND => 'YmdHisu',
61: ];
62: }
63:
64: public function isDate(): bool
65: {
66: return in_array($this->getValue(), self::getDateUnits());
67: }
68:
69: public function isTime(): bool
70: {
71: return in_array($this->getValue(), self::getTimeUnits());
72: }
73:
74: /**
75: * Used in DateTime::equalsUpTo()
76: * @return string
77: */
78: public function getComparisonFormat(): string
79: {
80: return self::getComparisonFormat()[$this->getValue()];
81: }
82:
83: }
| 50 % | Time\DayOfWeek.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time;
11:
12: /**
13: * Day of week as defined in ISO-8601 (1 for Monday through 7 for Sunday)
14: */
15: class DayOfWeek extends \Dogma\Enum\IntEnum
16: {
17:
18: public const MONDAY = 1;
19: public const TUESDAY = 2;
20: public const WEDNESDAY = 3;
21: public const THURSDAY = 4;
22: public const FRIDAY = 5;
23: public const SATURDAY = 6;
24: public const SUNDAY = 7;
25:
26: /**
27: * @return string[]
28: */
29: public static function getNames(): array
30: {
31: return [
32: 'monday',
33: 'tuesday',
34: 'wednesday',
35: 'thursday',
36: 'friday',
37: 'saturday',
38: 'sunday',
39: ];
40: }
41:
42: /**
43: * @return string[]
44: */
45: public static function getShortcuts(): array
46: {
47: return [
48: 'mon',
49: 'tue',
50: 'wed',
51: 'thu',
52: 'fri',
53: 'sat',
54: 'sun',
55: ];
56: }
57:
58: }
| 100 % | Time\exceptions\InvalidDateTimeException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time;
11:
12: class InvalidDateTimeException extends \Dogma\Exception
13: {
14:
15: public function __construct(string $dateTimeString, ?\Throwable $previous = null)
16: {
17: parent::__construct(sprintf('Invalid date/time string: %s', $dateTimeString), $previous);
18: }
19:
20: }
| 0 % | Time\exceptions\InvalidFormattingStringException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time;
11:
12: class InvalidFormattingStringException extends \Dogma\Exception
13: {
14:
15: }
| 0 % | Time\exceptions\InvalidIntervalException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time;
11:
12: class InvalidIntervalException extends \Dogma\Exception
13: {
14:
15: public function __construct(string $intervalString, ?\Throwable $previous = null)
16: {
17: parent::__construct(sprintf('Invalid date/time interval: %s', $intervalString), $previous);
18: }
19:
20: }
| 0 % | Time\Format\BranchNode.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Format;
11:
12: class BranchNode implements \Dogma\Time\Format\Node
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: public const LIST = 1;
17: public const PARENTHESES = 2;
18: public const SQUARE_BRACKETS = 3;
19: public const CURLY_BRACKETS = 4;
20:
21: /** @var int */
22: private $type;
23:
24: /** @var \Dogma\Time\Format\BranchNode|\Dogma\Time\Format\VariableNode|string */
25: private $nodes;
26:
27: /** @var int count of variable leaf nodes */
28: private $cardinality;
29:
30: /** @var string[] */
31: private $groups;
32:
33: /**
34: * @param int $type
35: * @param \Dogma\Time\Format\Node[]|string[] $nodes
36: */
37: public function __construct(int $type, array $nodes)
38: {
39: $this->type = $type;
40: $this->nodes = $nodes;
41: $this->cardinality = 0;
42: foreach ($nodes as $node) {
43: if ($node instanceof self) {
44: $this->cardinality += $node->getCardinality();
45: } elseif ($node instanceof VariableNode) {
46: $this->cardinality++;
47: }
48: }
49: }
50:
51: public function getCardinality(): int
52: {
53: return $this->cardinality;
54: }
55:
56:
57:
58: }
| 0 % | Time\Format\DateTimeValues.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Format;
11:
12: class DateTimeValues
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: public $year;
17: public $leapYear;
18: public $dayOfYear;
19: public $quarter;
20: public $month;
21: public $daysInMonth;
22: public $weekOfYear;
23: public $isoWeekYear;
24: public $dayOfWeek;
25: public $day;
26:
27: public $hours;
28: public $minutes;
29: public $seconds;
30: public $miliseconds;
31: public $microseconds;
32:
33: public $timezone;
34: public $dst;
35:
36: /** @var \DateTimeInterface|\Dogma\Time\Date|\Dogma\Time\Time */
37: public $dateTime;
38:
39: /**
40: * @param \DateTimeInterface|\Dogma\Time\Date|\Dogma\Time\Time $dateTime
41: */
42: public function __construct($dateTime, array $values)
43: {
44: $this->dateTime = $dateTime;
45: foreach ($values as $i => $v) {
46: ///
47: }
48: }
49:
50: }
| 0 % | Time\Format\FormatParser.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Format;
11:
12: use Dogma\Time\DateTimeFormatter;
13:
14: class FormatParser
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: private const DATE_CHARS = [
19: DateTimeFormatter::YEAR,
20: DateTimeFormatter::YEAR_SHORT,
21: DateTimeFormatter::DAY_OF_YEAR,
22: DateTimeFormatter::DAY_OF_YEAR_INDEX,
23: DateTimeFormatter::LEAP_YEAR,
24: DateTimeFormatter::QUARTER,
25: DateTimeFormatter::MONTH_LZ,
26: DateTimeFormatter::MONTH,
27: DateTimeFormatter::MONTH_NAME,
28: DateTimeFormatter::MONTH_NAME_SHORT,
29: DateTimeFormatter::DAYS_IN_MONTH,
30: DateTimeFormatter::WEEK_OF_YEAR,
31: DateTimeFormatter::ISO_WEEK_YEAR,
32: DateTimeFormatter::DAY_OF_WEEK,
33: DateTimeFormatter::DAY_OF_WEEK_INDEX,
34: DateTimeFormatter::DAY_OF_WEEK_NAME,
35: DateTimeFormatter::DAY_OF_WEEK_NAME_SHORT,
36: DateTimeFormatter::DAY_LZ,
37: DateTimeFormatter::DAY,
38: DateTimeFormatter::DAY_SUFFIX,
39: ];
40:
41: private const TIME_CHARS = [
42: DateTimeFormatter::HOURS_LZ,
43: DateTimeFormatter::HOURS,
44: DateTimeFormatter::HOURS_12_LZ,
45: DateTimeFormatter::HOURS_12,
46: DateTimeFormatter::AM_PM_UPPER,
47: DateTimeFormatter::AM_PM_LOWER,
48: DateTimeFormatter::MINUTES_LZ,
49: DateTimeFormatter::MINUTES,
50: DateTimeFormatter::SECONDS_LZ,
51: DateTimeFormatter::SECONDS,
52: DateTimeFormatter::MILISECONDS_LZ,
53: DateTimeFormatter::MILISECONDS,
54: DateTimeFormatter::MICROSECONDS_LZ,
55: DateTimeFormatter::MICROSECONDS,
56: ];
57:
58: private const TIMEZONE_CHARS = [
59: DateTimeFormatter::TIMEZONE_NAME,
60: DateTimeFormatter::TIMEZONE_NAME_SHORT,
61: DateTimeFormatter::TIMEZONE_OFFSET_COLON,
62: DateTimeFormatter::TIMEZONE_OFFSET,
63: DateTimeFormatter::TIMEZONE_OFFSET_SECONDS,
64: DateTimeFormatter::DAYLIGHT_SAVING_TIME,
65: ];
66:
67: private const MODIFIER_CHARS = [
68: Formatting::UPPER_CASE_MODIFIER,
69: Formatting::FIRST_UPPER_MODIFIER,
70: Formatting::IN_ON_AT_MODIFIER,
71: Formatting::SINCE_MODIFIER,
72: Formatting::UNTIL_MODIFIER,
73: Formatting::ORDINAL_MODIFIER,
74: ];
75:
76: private const GROUP_START_CHARS = [
77: Formatting::NO_ZEROS_GROUP_START,
78: Formatting::OPTIONAL_GROUP_START,
79: Formatting::NO_DUPLICATION_GROUP_START,
80: ];
81:
82: private const GROUP_END_CHARS = [
83: Formatting::NO_ZEROS_GROUP_END,
84: Formatting::OPTIONAL_GROUP_END,
85: Formatting::NO_DUPLICATION_GROUP_END,
86: ];
87:
88: private const SPECIAL_CHARS = self::DATE_CHARS
89: + self::TIME_CHARS
90: + self::TIMEZONE_CHARS
91: + self::MODIFIER_CHARS
92: + self::GROUP_START_CHARS
93: + self::GROUP_END_CHARS;
94:
95: private static $variables = [
96: DateTimeFormatter::YEAR => DateTimeFormatter::YEAR,
97: DateTimeFormatter::YEAR_SHORT => DateTimeFormatter::YEAR,
98: DateTimeFormatter::LEAP_YEAR => DateTimeFormatter::YEAR,
99:
100: DateTimeFormatter::DAY_OF_YEAR => DateTimeFormatter::DAY_OF_YEAR,
101: DateTimeFormatter::DAY_OF_YEAR_INDEX => DateTimeFormatter::DAY_OF_YEAR,
102:
103: DateTimeFormatter::QUARTER => DateTimeFormatter::QUARTER,
104:
105: DateTimeFormatter::MONTH_LZ => DateTimeFormatter::MONTH,
106: DateTimeFormatter::MONTH => DateTimeFormatter::MONTH,
107: DateTimeFormatter::MONTH_NAME => DateTimeFormatter::MONTH,
108: DateTimeFormatter::MONTH_NAME_SHORT => DateTimeFormatter::MONTH,
109:
110: DateTimeFormatter::DAYS_IN_MONTH => DateTimeFormatter::DAYS_IN_MONTH,
111:
112: DateTimeFormatter::WEEK_OF_YEAR => DateTimeFormatter::WEEK_OF_YEAR,
113:
114: DateTimeFormatter::ISO_WEEK_YEAR => DateTimeFormatter::ISO_WEEK_YEAR,
115:
116: DateTimeFormatter::DAY_OF_WEEK => DateTimeFormatter::DAY_OF_WEEK,
117: DateTimeFormatter::DAY_OF_WEEK_INDEX => DateTimeFormatter::DAY_OF_WEEK,
118: DateTimeFormatter::DAY_OF_WEEK_NAME => DateTimeFormatter::DAY_OF_WEEK,
119: DateTimeFormatter::DAY_OF_WEEK_NAME_SHORT => DateTimeFormatter::DAY_OF_WEEK,
120:
121: DateTimeFormatter::DAY_LZ => DateTimeFormatter::DAY,
122: DateTimeFormatter::DAY => DateTimeFormatter::DAY,
123:
124: DateTimeFormatter::HOURS_LZ => DateTimeFormatter::HOURS,
125: DateTimeFormatter::HOURS => DateTimeFormatter::HOURS,
126: DateTimeFormatter::HOURS_12_LZ => DateTimeFormatter::HOURS,
127: DateTimeFormatter::HOURS_12 => DateTimeFormatter::HOURS,
128: DateTimeFormatter::AM_PM_UPPER => DateTimeFormatter::HOURS,
129: DateTimeFormatter::AM_PM_LOWER => DateTimeFormatter::HOURS,
130:
131: DateTimeFormatter::MINUTES_LZ => DateTimeFormatter::MINUTES,
132: DateTimeFormatter::MINUTES => DateTimeFormatter::MINUTES,
133:
134: DateTimeFormatter::SECONDS_LZ => DateTimeFormatter::SECONDS,
135: DateTimeFormatter::SECONDS => DateTimeFormatter::SECONDS,
136:
137: DateTimeFormatter::MILISECONDS_LZ => DateTimeFormatter::MILISECONDS,
138: DateTimeFormatter::MILISECONDS => DateTimeFormatter::MILISECONDS,
139:
140: DateTimeFormatter::MICROSECONDS_LZ => DateTimeFormatter::MICROSECONDS,
141: DateTimeFormatter::MICROSECONDS => DateTimeFormatter::MICROSECONDS,
142:
143: DateTimeFormatter::TIMEZONE_NAME => DateTimeFormatter::TIMEZONE_OFFSET,
144: DateTimeFormatter::TIMEZONE_NAME_SHORT => DateTimeFormatter::TIMEZONE_OFFSET,
145: DateTimeFormatter::TIMEZONE_OFFSET_COLON => DateTimeFormatter::TIMEZONE_OFFSET,
146: DateTimeFormatter::TIMEZONE_OFFSET => DateTimeFormatter::TIMEZONE_OFFSET,
147: DateTimeFormatter::TIMEZONE_OFFSET_SECONDS => DateTimeFormatter::TIMEZONE_OFFSET,
148:
149: DateTimeFormatter::DAYLIGHT_SAVING_TIME => DateTimeFormatter::DAYLIGHT_SAVING_TIME,
150: ];
151:
152: /** @var \Dogma\Time\Format\BranchNode[] */
153: private $cachedFormats;
154:
155: /**
156: * nodes:
157: * node
158: * | node nodes
159: *
160: * node:
161: * variable
162: * | group
163: * | constant
164: *
165: * variable:
166: * /[A-Za-z]/ [modifiers]
167: *
168: * modifiers:
169: * modifier
170: * | modifier modifiers
171: *
172: * modifier:
173: * "^"
174: * | "!"
175: * | "="
176: * | ">"
177: * | "<"
178: * | "*"
179: *
180: * constant:
181: * /[^A-Za-z()[\]{}^!=><*]+/
182: * | "\" /[A-Za-z()[\]{}^!=><*]+/
183: * | "%" /[A-Za-z()[\]{}^!=><*]+/
184: *
185: * group:
186: * parentheses
187: * | squareBrackets
188: * | curlyBrackets
189: *
190: * parentheses:
191: * "(" nodes ")"
192: *
193: * squareBrackets:
194: * "[" nodes "]"
195: *
196: * curlyBrackets:
197: * "{" nodes "}"
198: *
199: * @param string $format
200: * @return \Dogma\Time\Format\BranchNode
201: */
202: public function parseFormat(string $format): BranchNode
203: {
204: if (isset($this->cachedFormats[$format])) {
205: return $this->cachedFormats[$format];
206: }
207: $chars = explode('', $format);
208: $nodes = $this->parseList($chars, 0);
209:
210: return new BranchNode(BranchNode::LIST, $nodes);
211: }
212:
213: private function parseList(array $chars, int $position): array
214: {
215: $nodes = [];
216: $modifiers = [];
217:
218: $escaped = false;
219: while (isset($chars[$position])) {
220: $char = $chars[$position];
221: if ($escaped) {
222: $nodes[] = $char;
223: $escaped = false;
224: continue;
225: }
226: switch ($char) {
227: case Formatting::ESCAPE_CHARACTER:
228: $escaped = true;
229: continue;
230: case Formatting::NO_ZEROS_GROUP_START:
231: case Formatting::OPTIONAL_GROUP_START:
232: case Formatting::NO_DUPLICATION_GROUP_START:
233: ///
234: break;
235: case Formatting::NO_ZEROS_GROUP_END:
236: case Formatting::OPTIONAL_GROUP_END:
237: case Formatting::NO_DUPLICATION_GROUP_END:
238: ///
239: break;
240: case Formatting::UPPER_CASE_MODIFIER:
241: case Formatting::FIRST_UPPER_MODIFIER:
242: case Formatting::IN_ON_AT_MODIFIER:
243: case Formatting::SINCE_MODIFIER:
244: case Formatting::UNTIL_MODIFIER:
245: case Formatting::ORDINAL_MODIFIER:
246: $modifiers[] = $char;
247: break;
248: case DateTimeFormatter::YEAR:
249: case DateTimeFormatter::YEAR_SHORT:
250: case DateTimeFormatter::DAY_OF_YEAR:
251: case DateTimeFormatter::DAY_OF_YEAR_INDEX:
252: case DateTimeFormatter::LEAP_YEAR:
253: case DateTimeFormatter::QUARTER:
254: case DateTimeFormatter::MONTH_LZ:
255: case DateTimeFormatter::MONTH:
256: case DateTimeFormatter::MONTH_NAME:
257: case DateTimeFormatter::MONTH_NAME_SHORT:
258: case DateTimeFormatter::DAYS_IN_MONTH:
259: case DateTimeFormatter::WEEK_OF_YEAR:
260: case DateTimeFormatter::ISO_WEEK_YEAR:
261: case DateTimeFormatter::DAY_OF_WEEK:
262: case DateTimeFormatter::DAY_OF_WEEK_INDEX:
263: case DateTimeFormatter::DAY_OF_WEEK_NAME:
264: case DateTimeFormatter::DAY_OF_WEEK_NAME_SHORT:
265: case DateTimeFormatter::DAY_LZ:
266: case DateTimeFormatter::DAY:
267: case DateTimeFormatter::DAY_SUFFIX:
268: ///
269: break;
270: }
271: }
272:
273: return $nodes;
274: }
275:
276: }
| 0 % | Time\Format\Formatting.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Format;
11:
12: class Formatting
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: public const ESCAPE_CHARACTER = '\\';
17:
18: // variables inside block [] must not contain only zeros. otherwise is block removed
19: // eg. "1.12.2017[ 00:00]" is converted to "1.12.2017"
20: public const NO_ZEROS_GROUP_START = '[';
21: public const NO_ZEROS_GROUP_END = ']';
22:
23: // variables inside block () must be different than current time. otherwise is block removed
24: // eg. "1.12.(2017)" is converted to "1.12." if the current year is 2017, otherwise to "1.12.2017"
25: public const OPTIONAL_GROUP_START = '(';
26: public const OPTIONAL_GROUP_END = ')';
27:
28: // variables inside block {} must be different from other date from the pair. otherwise is block removed
29: // eg. "1.12.{2017} - 31.12.2017" is converted to "1.12. - 31.12.2017"
30: public const NO_DUPLICATION_GROUP_START = '{';
31: public const NO_DUPLICATION_GROUP_END = '}';
32:
33: // print word with upper case letter
34: // - eg. "c^" --> "FRI", "PÁ"
35: public const UPPER_CASE_MODIFIER = '^';
36:
37: // print word with first upper case letter
38: // - eg. "N!" --> "February", "Únor"
39: public const FIRST_UPPER_MODIFIER = '!';
40:
41: // grammatical case used after 'at'
42: // - eg. "C=" --> "at friday", "v pátek"
43: public const IN_ON_AT_MODIFIER = '=';
44:
45: // grammatical case used after 'since'
46: // - eg. "C<" --> "until friday", "od pátku"
47: public const SINCE_MODIFIER = '>';
48:
49: // grammatical case used after 'until'
50: // - eg. "C>" --> "since friday", "do pátku"
51: public const UNTIL_MODIFIER = '<';
52:
53: // grammatical case used after "of" for names and ordinal suffix or dot for numbers
54: // - eg. "d* N*" --> "27th of april", "27. dubna"
55: // - eg. "N d*" --> "april 27th", "duben 27."
56: public const ORDINAL_MODIFIER = '*';
57:
58: }
| 0 % | Time\Format\Node.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Format;
11:
12: interface Node
13: {
14:
15: }
| 0 % | Time\Format\VariableNode.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Format;
11:
12: use Dogma\Time\DateTimeFormatter;
13:
14: class VariableNode implements \Dogma\Time\Format\Node
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var string */
19: private $format;
20:
21: /** @var string */
22: private $group;
23:
24: /** @var string */
25: private $modifiers;
26:
27: /** @var string */
28: private $value;
29:
30: /** @var string */
31: private $formatted;
32:
33: public function __construct(string $variable, string $format, string $modifiers)
34: {
35: $this->format = $format;
36: $this->group = self::$characterGroups[$format];
37: $this->modifiers = $modifiers;
38: }
39:
40: public function fillValue(DateTimeValues $values): void
41: {
42: switch ($this->group) {
43: case DateTimeFormatter::YEAR:
44: if ($values->year === null) {
45: $values->year = (int) $values->dateTime->format('Y');
46: }
47: $this->value = $this->formatted;
48: $this->formatted = (string) $values->year;
49: break;
50: case DateTimeFormatter::YEAR_SHORT:
51: if ($values->year === null) {
52: $values->year = (int) $values->dateTime->format('Y');
53: }
54: $this->value = $values->year;
55: $this->formatted = substr((string) $values->year, -2);
56: break;
57: case DateTimeFormatter::LEAP_YEAR:
58: if ($values->year === null) {
59: $values->year = (int) $values->dateTime->format('Y');
60: }
61: $this->value = $values->year;
62: $this->formatted = $values->dateTime->format('L');
63: break;
64: case DateTimeFormatter::DAY_OF_YEAR:
65: if ($values->dayOfYear === null) {
66: $values->dayOfYear = (int) $values->dateTime->format('z');
67: }
68: $this->value = $values->dayOfYear;
69: $this->formatted = (string) ($values->dayOfYear + 1);
70: break;
71: case DateTimeFormatter::DAY_OF_YEAR_INDEX:
72: if ($values->dayOfYear === null) {
73: $values->dayOfYear = (int) $values->dateTime->format('z');
74: }
75: $this->value = $values->dayOfYear;
76: $this->formatted = (string) $values->dayOfYear;
77: break;
78: case DateTimeFormatter::QUARTER:
79: if ($values->quarter === null) {
80: $values->quarter = (int) ($values->dateTime->format('n') / 3);
81: }
82: $this->value = $values->quarter;
83: $this->formatted = (string) $values->quarter;
84: break;
85: case DateTimeFormatter::MONTH_LZ:
86: if ($values->month === null) {
87: $values->month = (int) $values->dateTime->format('n');
88: }
89: $this->value = $values->month;
90: $this->formatted = $values->dateTime->format('m');
91: break;
92: case DateTimeFormatter::MONTH:
93: if ($values->month === null) {
94: $values->month = (int) $values->dateTime->format('n');
95: }
96: $this->value = $values->month;
97: $this->formatted = (string) $values->month;
98: break;
99: case DateTimeFormatter::MONTH_NAME:
100: if ($values->month === null) {
101: $values->month = (int) $values->dateTime->format('n');
102: }
103: $this->value = $values->month;
104: $this->formatted = $values->format('F');
105: break;
106: case DateTimeFormatter::MONTH_NAME_SHORT:
107: if ($values->month === null) {
108: $values->month = (int) $values->dateTime->format('n');
109: }
110: $this->value = $values->month;
111: $this->formatted = $values->format('M');
112: break;
113: }
114: }
115:
116: }
| 0 % | Time\Interval\DateInterval.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Time\Interval;
4:
5: use Dogma\Arr;
6: use Dogma\Time\InvalidIntervalException;
7:
8: class DateInterval implements \Dogma\Time\Interval\DateOrTimeInterval
9: {
10: use \Dogma\StrictBehaviorMixin;
11:
12: public const DEFAULT_FORMAT = 'y-m-d';
13:
14: /** @var int */
15: private $years;
16:
17: /** @var int */
18: private $months;
19:
20: /** @var int */
21: private $days;
22:
23: public function __construct(
24: int $years,
25: int $months = 0,
26: int $days = 0
27: ) {
28: $this->years = $years;
29: $this->months = $months;
30: $this->days = $days;
31: }
32:
33: public static function createFromDateInterval(\DateInterval $interval): self
34: {
35: $self = new static(0);
36: $self->years = $interval->invert ? -$interval->y : $interval->y;
37: $self->months = $interval->invert ? -$interval->m : $interval->m;
38: $self->days = $interval->invert ? -$interval->d : $interval->d;
39:
40: if ($interval->h !== 0 || $interval->i !== 0 || $interval->s !== 0 || $interval->f !==0) {
41: throw new InvalidIntervalException($interval->format('%r %y-%m-%d %h-%i-%s.%f'));
42: }
43:
44: return $self;
45: }
46:
47: public static function createFromDateIntervalString(string $string): self
48: {
49: $interval = new \DateInterval($string);
50:
51: return self::createFromDateInterval($interval);
52: }
53:
54: public static function createFromDateString(string $string): self
55: {
56: $interval = \DateInterval::createFromDateString($string);
57:
58: return self::createFromDateInterval($interval);
59: }
60:
61: // queries ---------------------------------------------------------------------------------------------------------
62:
63: public function toDateTimeInterval(): DateTimeInterval
64: {
65: return new DateTimeInterval($this->years, $this->months, $this->days);
66: }
67:
68: public function toNative(): \DateInterval
69: {
70: return $this->toDateTimeInterval()->toNative();
71: }
72:
73: /**
74: * @return \DateInterval[]
75: */
76: public function toPositiveNegative(): array
77: {
78: return $this->toDateTimeInterval()->toPositiveNegative();
79: }
80:
81: public function format(string $format = self::DEFAULT_FORMAT, ?DateTimeIntervalFormatter $formatter = null): string
82: {
83: if ($formatter === null) {
84: $formatter = new DateTimeIntervalFormatter();
85: }
86:
87: return $formatter->format($this->toDateTimeInterval(), $format);
88: }
89:
90: public function isZero(): bool
91: {
92: return $this->years === 0
93: && $this->months === 0
94: && $this->days === 0;
95: }
96:
97: public function isMixed(): bool
98: {
99: return !$this->isPositive() && !$this->isNegative();
100: }
101:
102: private function isPositive(): bool
103: {
104: return $this->years >= 0
105: && $this->months >= 0
106: && $this->days >= 0;
107: }
108:
109: private function isNegative(): bool
110: {
111: return $this->years < 0
112: && $this->months < 0
113: && $this->days < 0;
114: }
115:
116: // actions ---------------------------------------------------------------------------------------------------------
117:
118: public function add(self ...$other): self
119: {
120: $that = clone($this);
121: foreach ($other as $interval) {
122: $that->years += $interval->years;
123: $that->months += $interval->months;
124: $that->days += $interval->days;
125: }
126:
127: return $that->normalize();
128: }
129:
130: public function subtract(self ...$other): self
131: {
132: return $this->add(...Arr::map($other, function (DateTimeInterval $interval) {
133: return $interval->invert();
134: }));
135: }
136:
137: public function invert(): self
138: {
139: return new self(-$this->years, -$this->months, -$this->days);
140: }
141:
142: public function abs(): self
143: {
144: if ($this->getYearsFraction() >= 0.0) {
145: return $this;
146: } else {
147: return $this->invert();
148: }
149: }
150:
151: /**
152: * Normalizes values by summarizing smaller units into bigger. eg: '34 days' -> '1 month, 4 days'
153: * @return self
154: */
155: public function normalize(): self
156: {
157: $days = $this->days;
158: $months = $this->months;
159: $years = $this->years;
160:
161: if ($days >= 30) {
162: $months += (int) ($days / 30);
163: $days = $days % 30;
164: } elseif ($days <= -30) {
165: $months += (int) ($days / 30);
166: $days = $days % 30;
167: }
168: if ($months >= 12) {
169: $years += (int) ($months / 12);
170: $months = $months % 12;
171: } elseif ($months <= -12) {
172: $years += (int) ($months / 12);
173: $months = $months % 12;
174: }
175:
176: return new self($years, $months, $days);
177: }
178:
179: // getters ---------------------------------------------------------------------------------------------------------
180:
181: /**
182: * @return int[]
183: */
184: public function getValues(): array
185: {
186: return [
187: $this->years,
188: $this->months,
189: $this->days,
190: ];
191: }
192:
193: public function getYears(): int
194: {
195: return $this->years;
196: }
197:
198: public function getYearsFraction(): float
199: {
200: return $this->years
201: + $this->months / 12
202: + $this->days / 365;
203: }
204:
205: public function getMonths(): int
206: {
207: return $this->months;
208: }
209:
210: public function getMonthsTotal(): float
211: {
212: return $this->getMonthsFraction()
213: + $this->years * 12;
214: }
215:
216: public function getMonthsFraction(): float
217: {
218: return $this->months
219: + $this->days / 30;
220: }
221:
222: public function getWeeks(): int
223: {
224: return (int) floor($this->days / 7);
225: }
226:
227: public function getWeeksTotal(): float
228: {
229: return $this->getDaysTotal() / 7;
230: }
231:
232: public function getWeeksFraction(): float
233: {
234: return $this->getDays() / 7;
235: }
236:
237: public function getDays(): int
238: {
239: return $this->days;
240: }
241:
242: public function getDaysTotal(): float
243: {
244: return $this->getDays()
245: + $this->months * 30
246: + $this->years * 12 * 30;
247: }
248:
249: }
| 100 % | Time\Interval\DateOrTimeInterval.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Time\Interval;
4:
5: interface DateOrTimeInterval
6: {
7:
8: public function toNative(): \DateInterval;
9:
10: /**
11: * @return \DateInterval[]
12: */
13: public function toPositiveNegative(): array;
14:
15: public function format(string $format = '', ?DateTimeIntervalFormatter $formatter = null): string;
16:
17: public function isZero(): bool;
18:
19: public function isMixed(): bool;
20:
21: //public function add(self ...$other): self;
22:
23: //public function subtract(self ...$other): self;
24:
25: public function invert();//: self;
26:
27: public function abs();//: self;
28:
29: /**
30: * Normalizes values by summarizing smaller units into bigger. eg: '34 days' -> '1 month, 4 days'
31: * @return self
32: */
33: public function normalize();//: self;
34:
35: /**
36: * @return int[]
37: */
38: public function getValues(): array;
39:
40: }
| 6 % | Time\Interval\DateTimeInterval.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Interval;
11: use Dogma\Arr;
12:
13: /**
14: * Replacement of \DateInterval
15: * - immutable!
16: * - capable of holding mixed sign offsets (eg: "+1 year, -2 months")
17: * - calculations and rounding
18: * - microseconds
19: *
20: * Since interval is not anchored to some starting time, exact size of some time units is not known.
21: * Therefore in calculations where different units are compared or calculated:
22: * - every month has 30 days
23: * - every year has 365 days
24: * - every day has 24 hours
25: * This means that calculations containing normalization and denormalization (eg: getXyzTotal()) are not commutative
26: * and may lead to unexpected results. For precise time calculations use timestamps instead.
27: */
28: class DateTimeInterval implements \Dogma\Time\Interval\DateOrTimeInterval
29: {
30: use \Dogma\StrictBehaviorMixin;
31:
32: public const DEFAULT_FORMAT = 'y-m-d h:i:S';
33:
34: /** @var int */
35: private $years;
36:
37: /** @var int */
38: private $months;
39:
40: /** @var int */
41: private $days;
42:
43: /** @var int */
44: private $hours;
45:
46: /** @var int */
47: private $minutes;
48:
49: /** @var int */
50: private $seconds;
51:
52: /** @var int */
53: private $microseconds;
54:
55: public function __construct(
56: int $years,
57: int $months = 0,
58: int $days = 0,
59: int $hours = 0,
60: int $minutes = 0,
61: int $seconds = 0,
62: int $microseconds = 0
63: ) {
64: $this->years = $years;
65: $this->months = $months;
66: $this->days = $days;
67: $this->hours = $hours;
68: $this->minutes = $minutes;
69: $this->seconds = $seconds;
70: $this->microseconds = $microseconds;
71: }
72:
73: public static function createFromDateInterval(\DateInterval $interval): self
74: {
75: $self = new static(0);
76: $self->years = $interval->invert ? -$interval->y : $interval->y;
77: $self->months = $interval->invert ? -$interval->m : $interval->m;
78: $self->days = $interval->invert ? -$interval->d : $interval->d;
79: $self->hours = $interval->invert ? -$interval->h : $interval->h;
80: $self->minutes = $interval->invert ? -$interval->i : $interval->i;
81: $self->seconds = $interval->invert ? -$interval->s : $interval->s;
82: $self->microseconds = $interval->invert ? (int) (-$interval->f * 1000000) : (int) ($interval->f * 1000);
83:
84: return $self;
85: }
86:
87: public static function createFromDateIntervalString(string $string): self
88: {
89: $interval = new \DateInterval($string);
90:
91: return self::createFromDateInterval($interval);
92: }
93:
94: public static function createFromDateString(string $string): self
95: {
96: $interval = \DateInterval::createFromDateString($string);
97:
98: return self::createFromDateInterval($interval);
99: }
100:
101: // queries ---------------------------------------------------------------------------------------------------------
102:
103: /**
104: * Subtracts positive and negative values if needed
105: * @return \DateInterval
106: */
107: public function toNative(): \DateInterval
108: {
109: if ($this->isPositive() || $this->isNegative()) {
110: return self::toNativeSimple($this);
111: }
112: $that = $this;
113: $inverted = false;
114: if ($this->getYearsFraction() < 0.0) {
115: $that = $this->invert();
116: $inverted = true;
117: }
118:
119: $years = $that->years;
120: $months = $that->months;
121: $days = $that->days;
122: $hours = $that->hours;
123: $minutes = $that->minutes;
124: $seconds = $that->seconds;
125: $microseconds = $that->microseconds;
126:
127: if ($microseconds < 0) {
128: $moveSeconds = (int) ($microseconds / 1000000) - 1;
129: $seconds += $moveSeconds;
130: $microseconds += $moveSeconds * 1000000;
131: }
132: if ($seconds < 0) {
133: $moveMinutes = (int) ($seconds / 60) - 1;
134: $minutes += $moveMinutes;
135: $seconds += $moveMinutes * 60;
136: }
137: if ($minutes < 0) {
138: $moveHours = (int) ($minutes / 60) - 1;
139: $hours += $moveHours;
140: $minutes += $moveHours * 60;
141: }
142: if ($hours < 0) {
143: $moveDays = (int) ($hours / 24) - 1;
144: $days += $moveDays;
145: $hours += $moveDays * 24;
146: }
147: if ($days < 0) {
148: $moveMonths = (int) ($days / 30) - 1;
149: $months += $moveMonths;
150: $days += $moveMonths * 30;
151: }
152: if ($months < 0) {
153: $moveYears = (int) ($years / 12) - 1;
154: $years += $moveYears;
155: $months += $moveYears * 12;
156: }
157: if ($years < 0) {
158: throw new \Dogma\ShouldNotHappenException('Years should always be positive at this point.');
159: }
160:
161: $interval = new self($years, $months, $days, $hours, $minutes, $seconds, $microseconds);
162: if ($inverted) {
163: $interval = $interval->invert();
164: }
165:
166: return self::toNativeSimple($interval);
167: }
168:
169: private static function toNativeSimple(self $that): \DateInterval
170: {
171: $interval = new \DateInterval('P0Y');
172:
173: if ($that->isNegative()) {
174: $interval->invert = true;
175: $that = $that->invert();
176: }
177: $interval->y = $that->years;
178: $interval->m = $that->months;
179: $interval->d = $that->days;
180: $interval->h = $that->hours;
181: $interval->i = $that->minutes;
182: $interval->s = $that->seconds;
183: $interval->f = $that->microseconds / 1000000;
184:
185: return $interval;
186: }
187:
188: /**
189: * Separates positive and negative values to two instances
190: * @return \DateInterval[]|int[] ($positive, $negative, $microseconds)
191: */
192: public function toPositiveNegative(): array
193: {
194: $positive = new \DateInterval('P0Y');
195: $negative = new \DateInterval('P0Y');
196: $negative->invert = true;
197:
198: if ($this->years >= 0) {
199: $positive->y = $this->years;
200: } else {
201: $negative->y = -$this->years;
202: }
203: if ($this->months >= 0) {
204: $positive->m = $this->months;
205: } else {
206: $negative->m = -$this->months;
207: }
208: if ($this->days >= 0) {
209: $positive->d = $this->days;
210: } else {
211: $negative->d = -$this->days;
212: }
213: if ($this->hours >= 0) {
214: $positive->h = $this->hours;
215: } else {
216: $negative->h = -$this->hours;
217: }
218: if ($this->minutes >= 0) {
219: $positive->i = $this->minutes;
220: } else {
221: $negative->i = -$this->minutes;
222: }
223: if ($this->seconds >= 0) {
224: $positive->s = $this->seconds;
225: } else {
226: $negative->s = -$this->seconds;
227: }
228:
229: if ($this->microseconds >= 0) {
230: $positive->f = $this->microseconds / 1000000;
231: } else {
232: $negative->f = -$this->microseconds / 1000000;
233: }
234:
235: return [$positive, $negative];
236: }
237:
238: public function getDatePart(): DateInterval
239: {
240: return new DateInterval($this->years, $this->months, $this->days);
241: }
242:
243: public function getTimePart(): TimeInterval
244: {
245: return new TimeInterval($this->hours, $this->minutes, $this->seconds, $this->microseconds);
246: }
247:
248: public function format(string $format = self::DEFAULT_FORMAT, ?DateTimeIntervalFormatter $formatter = null): string
249: {
250: if ($formatter === null) {
251: $formatter = new DateTimeIntervalFormatter();
252: }
253:
254: return $formatter->format($this, $format);
255: }
256:
257: public function isZero(): bool
258: {
259: return $this->years === 0
260: && $this->months === 0
261: && $this->days === 0
262: && $this->hours === 0
263: && $this->minutes === 0
264: && $this->seconds === 0
265: && $this->microseconds === 0;
266: }
267:
268: public function isMixed(): bool
269: {
270: return !$this->isPositive() && !$this->isNegative();
271: }
272:
273: private function isPositive(): bool
274: {
275: return $this->years >= 0
276: && $this->months >= 0
277: && $this->days >= 0
278: && $this->hours >= 0
279: && $this->minutes >= 0
280: && $this->seconds >= 0
281: && $this->microseconds >= 0;
282: }
283:
284: private function isNegative(): bool
285: {
286: return $this->years < 0
287: && $this->months < 0
288: && $this->days < 0
289: && $this->hours < 0
290: && $this->minutes < 0
291: && $this->seconds < 0
292: && $this->microseconds < 0;
293: }
294:
295: // actions ---------------------------------------------------------------------------------------------------------
296:
297: public function add(self ...$other): self
298: {
299: $that = clone($this);
300: foreach ($other as $interval) {
301: $that->years += $interval->years;
302: $that->months += $interval->months;
303: $that->days += $interval->days;
304: $that->hours += $interval->hours;
305: $that->minutes += $interval->minutes;
306: $that->seconds += $interval->seconds;
307: $that->microseconds += $interval->microseconds;
308: }
309:
310: return $that->normalize(true);
311: }
312:
313: public function subtract(self ...$other): self
314: {
315: return $this->add(...Arr::map($other, function (DateTimeInterval $interval) {
316: return $interval->invert();
317: }));
318: }
319:
320: public function invert(): self
321: {
322: return new self(-$this->years, -$this->months, -$this->days, -$this->hours, -$this->minutes, -$this->seconds, -$this->microseconds);
323: }
324:
325: public function abs(): self
326: {
327: if ($this->getYearsFraction() >= 0.0) {
328: return $this;
329: } else {
330: return $this->invert();
331: }
332: }
333:
334: /**
335: * Normalizes values by summarizing smaller units into bigger. eg: '34 days' -> '1 month, 4 days'
336: * @param bool $safeOnly
337: * @return self
338: */
339: public function normalize(bool $safeOnly = false): self
340: {
341: $microseconds = $this->microseconds;
342: $seconds = $this->seconds;
343: $minutes = $this->minutes;
344: $hours = $this->hours;
345: $days = $this->days;
346: $months = $this->months;
347: $years = $this->years;
348:
349: if ($microseconds >= 1000000) {
350: $seconds += (int) ($microseconds / 1000000);
351: $microseconds = $microseconds % 1000000;
352: } elseif ($microseconds <= -1000000) {
353: $seconds += (int) ($microseconds / 1000000);
354: $microseconds = $microseconds % 1000000;
355: }
356: if ($seconds >= 60) {
357: $minutes += (int) ($seconds / 60);
358: $seconds = $seconds % 60;
359: } elseif ($seconds <= -60) {
360: $minutes += (int) ($seconds / 60);
361: $seconds = $seconds % 60;
362: }
363: if ($minutes >= 60) {
364: $hours += (int) ($minutes / 60);
365: $minutes = $minutes % 60;
366: } elseif ($minutes <= -60) {
367: $hours += (int) ($minutes / 60);
368: $minutes = $minutes % 60;
369: }
370:
371: if ($safeOnly) {
372: return new self($years, $months, $days, $hours, $minutes, $seconds, $microseconds);
373: }
374:
375: if ($hours >= 24) {
376: $days += (int) ($hours / 24);
377: $hours = $hours % 24;
378: } elseif ($hours <= -24) {
379: $days += (int) ($hours / 24);
380: $hours = $hours % 24;
381: }
382: if ($days >= 30) {
383: $months += (int) ($days / 30);
384: $days = $days % 30;
385: } elseif ($days <= -30) {
386: $months += (int) ($days / 30);
387: $days = $days % 30;
388: }
389: if ($months >= 12) {
390: $years += (int) ($months / 12);
391: $months = $months % 12;
392: } elseif ($months <= -12) {
393: $years += (int) ($months / 12);
394: $months = $months % 12;
395: }
396:
397: return new self($years, $months, $days, $hours, $minutes, $seconds, $microseconds);
398: }
399:
400: public function roundToTwoValues(bool $useWeeks = false): self
401: {
402: $years = $this->getYearsFraction();
403: if (abs($years) >= 1) {
404: $wholeYears = (int) round($years);
405: $months = (int) round(($years - $wholeYears) * 12);
406: if (abs($months) === 12) {
407: $wholeYears += (int) ($months / 12);
408: $months = 0;
409: }
410: return new self($wholeYears, $months);
411: }
412:
413: $months = $this->getMonthsFraction();
414: if (abs($months) >= 1) {
415: $wholeMonths = (int) round($months);
416: $days = (int) round(($months - $wholeMonths) * 30);
417: if (abs($days) === 30) {
418: $wholeMonths += (int) ($days / 30);
419: $days = 0;
420: }
421: if ($useWeeks) {
422: $days = (int) (round($days / 7) * 7);
423: }
424: return new self(0, $wholeMonths, $days);
425: }
426:
427: if ($useWeeks) {
428: $weeks = $this->getWeeksFraction();
429: if (abs($weeks) >= 1) {
430: $days = (int) round($this->getDaysFraction());
431: return new self(0, 0, $days);
432: }
433: }
434:
435: $days = $this->getDaysFraction();
436: if (abs($days) >= 1) {
437: $wholeDays = (int) round($days);
438: $hours = (int) round(($days - $wholeDays) * 24);
439: if (abs($hours) === 24) {
440: $wholeDays += (int) ($hours / 24);
441: $hours = 0;
442: }
443: return new self(0, 0, $wholeDays, $hours);
444: }
445:
446: $hours = $this->getHoursTotal();
447: if (abs($hours) >= 1) {
448: $wholeHours = (int) round($hours);
449: $minutes = (int) round(($hours - $wholeHours) * 60);
450: if (abs($minutes) === 60) {
451: $wholeHours += (int) ($minutes / 60);
452: $minutes = 0;
453: }
454: return new self(0, 0, 0, $wholeHours, $minutes);
455: }
456:
457: $minutes = $this->getMinutesFraction();
458: if (abs($minutes) >= 1) {
459: $wholeMinutes = (int) round($minutes);
460: $seconds = (int) round(($minutes - $wholeMinutes) * 60);
461: if (abs($seconds) === 60) {
462: $wholeMinutes += (int) ($seconds / 60);
463: $seconds = 0;
464: }
465: return new self(0, 0, 0, 0, $wholeMinutes, $seconds);
466: }
467:
468: return new self(0, 0, 0, 0, 0, $this->seconds, $this->microseconds);
469: }
470:
471: public function roundToSingleValue(bool $useWeeks = false): self
472: {
473: $years = (int) round($this->getYearsFraction());
474: if (abs($years) >= 1) {
475: return new self($years);
476: }
477:
478: $months = (int) round($this->getMonthsFraction());
479: if (abs($months) >= 1) {
480: return new self(0, $months);
481: }
482:
483: if ($useWeeks) {
484: $weeks = (int) round($this->getWeeksFraction());
485: if (abs($weeks) >= 1) {
486: return new self(0, 0, $weeks * 7);
487: }
488: }
489:
490: $days = (int) round($this->getDaysFraction());
491: if (abs($days) >= 1) {
492: return new self(0, 0, $days);
493: }
494:
495: $hours = (int) round($this->getHoursTotal());
496: if (abs($hours) >= 1) {
497: return new self(0, 0, 0, $hours);
498: }
499:
500: $minutes = (int) round($this->getMinutesFraction());
501: if (abs($minutes) >= 1) {
502: return new self(0, 0, 0, 0, $minutes);
503: }
504:
505: $seconds = (int) round($this->getSecondsFraction());
506: if (abs($seconds) >= 1) {
507: return new self(0, 0, 0, 0, 0, $seconds);
508: }
509:
510: return new self(0, 0, 0, 0, 0, 0, $this->microseconds);
511: }
512:
513: // getters ---------------------------------------------------------------------------------------------------------
514:
515: /**
516: * @return int[]
517: */
518: public function getValues(): array
519: {
520: return [
521: $this->years,
522: $this->months,
523: $this->days,
524: $this->hours,
525: $this->minutes,
526: $this->seconds,
527: $this->microseconds,
528: ];
529: }
530:
531: public function getYears(): int
532: {
533: return $this->years;
534: }
535:
536: public function getYearsFraction(): float
537: {
538: return $this->years
539: + $this->months / 12
540: + $this->days / 365
541: + $this->hours / 365 / 24
542: + $this->minutes / 365 / 24 / 60
543: + $this->seconds / 365 / 24 / 60 / 60
544: + $this->microseconds / 365 / 24 / 60 / 60 / 1000000;
545: }
546:
547: public function getMonths(): int
548: {
549: return $this->months;
550: }
551:
552: public function getMonthsTotal(): float
553: {
554: return $this->getMonthsFraction()
555: + $this->years * 12;
556: }
557:
558: public function getMonthsFraction(): float
559: {
560: return $this->months
561: + $this->days / 30
562: + $this->hours / 30 / 24
563: + $this->minutes / 30 / 24 / 60
564: + $this->seconds / 30 / 24 / 60 / 60
565: + $this->microseconds / 30 / 24 / 60 / 60 / 1000000;
566: }
567:
568: public function getWeeks(): int
569: {
570: return (int) floor($this->days / 7);
571: }
572:
573: public function getWeeksTotal(): float
574: {
575: return $this->getDaysTotal() / 7;
576: }
577:
578: public function getWeeksFraction(): float
579: {
580: return $this->getDaysFraction() / 7;
581: }
582:
583: public function getDays(): int
584: {
585: return $this->days;
586: }
587:
588: public function getDaysTotal(): float
589: {
590: return $this->getDaysFraction()
591: + $this->months * 30
592: + $this->years * 12 * 30;
593: }
594:
595: public function getDaysFraction(): float
596: {
597: return $this->days
598: + $this->hours / 24
599: + $this->minutes / 24 / 60
600: + $this->seconds / 24 / 60 / 60
601: + $this->microseconds / 24 / 60 / 60 / 1000000;
602: }
603:
604: public function getHours(): int
605: {
606: return $this->hours;
607: }
608:
609: public function getHoursTotal(): float
610: {
611: return $this->getHoursFraction()
612: + $this->days * 24
613: + $this->months * 30 * 24
614: + $this->years * 12 * 30 * 24;
615: }
616:
617: public function getHoursFraction(): float
618: {
619: return $this->hours
620: + $this->minutes / 60
621: + $this->seconds / 60 / 60
622: + $this->microseconds / 60 / 60 / 1000000;
623: }
624:
625: public function getMinutes(): int
626: {
627: return $this->minutes;
628: }
629:
630: public function getMinutesTotal(): float
631: {
632: return $this->getMinutesFraction()
633: + $this->hours * 60
634: + $this->days * 24 * 60
635: + $this->months * 30 * 24 * 60
636: + $this->years * 12 * 30 * 24 * 60;
637: }
638:
639: public function getMinutesFraction(): float
640: {
641: return $this->minutes
642: + $this->seconds / 60
643: + $this->microseconds / 60 / 1000000;
644: }
645:
646: public function getSeconds(): int
647: {
648: return $this->seconds;
649: }
650:
651: public function getSecondsTotal(): float
652: {
653: return $this->getSecondsFraction()
654: + $this->minutes * 60
655: + $this->hours * 60 * 60
656: + $this->days * 24 * 60 * 60
657: + $this->months * 30 * 24 * 60 * 60
658: + $this->years * 12 * 30 * 24 * 60 * 60;
659: }
660:
661: public function getSecondsFraction(): float
662: {
663: return $this->seconds
664: + $this->microseconds / 1000000;
665: }
666:
667: public function getMicroseconds(): int
668: {
669: return $this->microseconds;
670: }
671:
672: public function getMicrosecondsTotal(): int
673: {
674: return $this->microseconds
675: + $this->seconds * 1000000
676: + $this->minutes * 60 * 1000000
677: + $this->hours * 60 * 60 * 1000000
678: + $this->days * 24 * 60 * 60 * 1000000
679: + $this->months * 30 * 24 * 60 * 60 * 1000000
680: + $this->years * 12 * 30 * 24 * 60 * 60 * 1000000;
681: }
682:
683: }
| 0 % | Time\Interval\DateTimeIntervalFormatter.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Interval;
11:
12: use Dogma\Language\Localization\Translator;
13: use Dogma\Str;
14: use Dogma\Time\Format\Formatting;
15:
16: class DateTimeIntervalFormatter
17: {
18: use \Dogma\StrictBehaviorMixin;
19:
20: public const YEARS = 'y';
21: public const YEARS_FRACTION = 'Y';
22: public const YEARS_WORD = 'Z';
23: public const YEARS_UNIT = 'z';
24:
25: public const MONTHS = 'm';
26: public const MONTHS_FRACTION = 'M';
27: public const MONTHS_TOTAL = 'n';
28: public const MONTHS_TOTAL_FRACTION = 'N';
29: public const MONTHS_WORD = 'O';
30: public const MONTHS_UNIT = 'o';
31:
32: public const WEEKS = 'w';
33: public const WEEKS_FRACTION = 'W';
34: public const WEEKS_TOTAL = 'x';
35: public const WEEKS_TOTAL_FRACTION = 'X';
36: public const WEEKS_WORD = 'A';
37: public const WEEKS_UNIT = 'a';
38:
39: public const DAYS = 'd';
40: public const DAYS_FRACTION = 'D';
41: public const DAYS_TOTAL = 'e';
42: public const DAYS_TOTAL_FRACTION = 'E';
43: public const DAYS_WORD = 'F';
44: public const DAYS_UNIT = 'f';
45:
46: public const HOURS = 'h';
47: public const HOURS_FRACTION = 'H';
48: public const HOURS_TOTAL = 'g';
49: public const HOURS_TOTAL_FRACTION = 'G';
50: public const HOURS_WORD = 'L';
51: public const HOURS_UNIT = 'l';
52:
53: public const MINUTES = 'i';
54: public const MINUTES_FRACTION = 'I';
55: public const MINUTES_TOTAL = 'j';
56: public const MINUTES_TOTAL_FRACTION = 'J';
57: public const MINUTES_WORD = 'K';
58: public const MINUTES_UNIT = 'k';
59:
60: public const SECONDS = 's';
61: public const SECONDS_FRACTION = 'S';
62: public const SECONDS_TOTAL = 't';
63: public const SECONDS_TOTAL_FRACTION = 'T';
64: public const SECONDS_WORD = 'R';
65: public const SECONDS_UNIT = 'r';
66:
67: public const MILISECONDS = 'v';
68: public const MILISECONDS_TOTAL = 'V';
69: public const MILISECONDS_WORD = 'B';
70: public const MILISECONDS_UNIT = 'b';
71:
72: public const MICROSECONDS = 'u';
73: public const MICROSECONDS_TOTAL = 'U';
74: public const MICROSECONDS_WORD = 'C';
75: public const MICROSECONDS_UNIT = 'c';
76:
77: public const PRETTY_DOUBLE_WORDS = 'P';
78: public const PRETTY_DOUBLE_UNITS = 'P';
79: public const PRETTY_SINGLE_WORDS = 'Q';
80: public const PRETTY_SINGLE_UNITS = 'q';
81:
82: public const FORMAT_DEFAULT = 'y-m-d h:i:S';
83: public const FORMAT_FULL_WORDS = '[yZ, ][mO, ]dF[, hL][, iK][, SR]';
84: public const FORMAT_FULL_UNITS = '[yz, ][mo, ]df[, hl][, ik][, Sr]';
85:
86: /** @var string[] */
87: private static $specialCharacters = [
88: self::YEARS,
89: self::YEARS_FRACTION,
90: self::YEARS_UNIT,
91: self::YEARS_WORD,
92: self::MONTHS,
93: self::MONTHS_FRACTION,
94: self::MONTHS_TOTAL,
95: self::MONTHS_TOTAL_FRACTION,
96: self::MONTHS_UNIT,
97: self::MONTHS_WORD,
98: self::WEEKS,
99: self::WEEKS_FRACTION,
100: self::WEEKS_TOTAL,
101: self::WEEKS_TOTAL_FRACTION,
102: self::WEEKS_UNIT,
103: self::WEEKS_WORD,
104: self::DAYS,
105: self::DAYS_FRACTION,
106: self::DAYS_TOTAL,
107: self::DAYS_TOTAL_FRACTION,
108: self::DAYS_UNIT,
109: self::DAYS_WORD,
110: self::HOURS,
111: self::HOURS_FRACTION,
112: self::HOURS_TOTAL,
113: self::HOURS_TOTAL_FRACTION,
114: self::HOURS_UNIT,
115: self::HOURS_WORD,
116: self::MINUTES,
117: self::MINUTES_FRACTION,
118: self::MINUTES_TOTAL,
119: self::MINUTES_TOTAL_FRACTION,
120: self::MINUTES_UNIT,
121: self::MINUTES_WORD,
122: self::SECONDS,
123: self::SECONDS_FRACTION,
124: self::SECONDS_TOTAL,
125: self::SECONDS_TOTAL_FRACTION,
126: self::SECONDS_UNIT,
127: self::SECONDS_WORD,
128: self::MILISECONDS,
129: self::MILISECONDS_TOTAL,
130: self::MILISECONDS_UNIT,
131: self::MILISECONDS_WORD,
132: self::MICROSECONDS,
133: self::MICROSECONDS_TOTAL,
134: self::MICROSECONDS_UNIT,
135: self::MICROSECONDS_WORD,
136: self::PRETTY_DOUBLE_WORDS,
137: self::PRETTY_DOUBLE_UNITS,
138: self::PRETTY_SINGLE_WORDS,
139: self::PRETTY_SINGLE_UNITS,
140: ];
141:
142: /** @var string */
143: private $format;
144:
145: /** @var int */
146: private $maxDecimals;
147:
148: /** @var string */
149: private $decimalPoint;
150:
151: /** @var \Dogma\Language\Localization\Translator|null */
152: private $translator;
153:
154: public function __construct(
155: string $format = self::FORMAT_DEFAULT,
156: int $maxDecimals = 1,
157: string $decimalPoint = '.',
158: ?Translator $translator = null
159: ) {
160: $this->format = $format;
161: $this->maxDecimals = $maxDecimals;
162: $this->decimalPoint = $decimalPoint;
163: $this->translator = $translator;
164: }
165:
166: /**
167: * Letter assignment:
168: * w µs ms day__ hour minute h month pty second µs ms week year
169: * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
170: *
171: * Use "[" and "]" for optional groups. Group containing a value of zero will not be part of output. Eg:
172: * - "[m O, ]d F" will print "5 months, 10 days" or "10 days" if months are 0.
173: * - "[m O, d F, ]h l" will print "0 months, 5 days, 2 hours" because both values inside group must be 0 to skip group.
174: *
175: * Ch. Description Example values
176: * ---- ------------------------------------------- --------------
177: * Escaping:
178: * % Escape character. Use %% for printing "%"
179: *
180: * Skip groups:
181: * [ Group start, skip if zero
182: * ] Group end, skip if zero
183: *
184: * Modifiers:
185: * ^ - Upper case letters
186: * ! - Starts with upper case letter
187: *
188: * Objects:
189: * Y Years fraction 1.5, 3.2, -3.2
190: * y Years 1, 3, -3
191: * Z 'years' word year, years, years
192: * z 'y' for years y, y, y
193: *
194: * M Months fraction (based on 30 days month) 1.5, 3.2, -3.2
195: * m Months 1, 3, -3
196: * N Months total fraction 1.5, 27.2, -3.2
197: * n Months total 1, 27, -3
198: * O 'months' word month, months, months
199: * o 'm' for months m, m, m
200: *
201: * W Weeks fraction (calculated from days) 1.5, 3.2, -3.2
202: * w Weeks (calculated from days) 1, 3, -3
203: * X Weeks total fraction (calculated from days) 1.5, 55.2, -3.2
204: * x Weeks total (calculated from days) 1, 55, -3
205: * A 'weeks' word week, weeks, weeks
206: * a 'w' for weeks w, w, w
207: *
208: * D Days fraction 1.5, 3.2, -3.2
209: * d Days 1, 3, -3
210: * E Days total fraction 1.5, 33.2, -3.2
211: * e Days total 1, 33, -3
212: * F 'days' word day, days, days
213: * f 'd' for days d, d, d
214: *
215: * H Hours fraction 1.5, 3.2, -3.2
216: * h Hours 1, 3, -3
217: * G Hours total fraction 1.5, 27.3, -3.2
218: * g Hours total 1, 27, -3
219: * L 'hours' word hour, hours, hours
220: * l 'h' for hours h, h, h
221: *
222: * I Minutes fraction 1.5, 3.2, -3.2
223: * i Minutes 1, 3, -2
224: * J Minutes total fraction 1.5, 63.2, -3.2
225: * j Minutes total 1.5, 63, -3
226: * K 'minutes' word minute, minutes, minutes
227: * k 'm' for minutes m, m, m
228: *
229: * S Seconds fraction 1.5, 3.2, -3.2
230: * s Seconds 1, 3, -3
231: * T Seconds total fraction 1.5, 63.2, -3.2
232: * t Seconds total 1, 63, -3
233: * R 'seconds' word second, seconds, seconds
234: * r 's' for seconds s, s, s
235: *
236: * V Miliseconds total (calculated from µs) 7, 108952
237: * v Miliseconds (calculated from µs) 7, 52
238: * B 'miliseconds' word miliseconds
239: * b 'ms' for miliseconds ms
240: *
241: * U Microseconds total 7701, 108952738
242: * u Microseconds 7701, 52738
243: * C 'microseconds' word microseconds
244: * c 'µs' for microseconds µs
245: *
246: * P Pretty, two values "2 weeks, 1 day", "2 weeks", "2 weeks, -1 day"
247: * p Pretty, two values, units "2w, 1d", "2w", "2w, -1d"
248: * Q Pretty, single value "15 days", "2 weeks", "13 days"
249: * q Pretty, single value, units "15d", "2w", "13d"
250: *
251: * @param \Dogma\Time\Interval\DateTimeInterval $interval
252: * @param string|null $format
253: * @param int|null $maxDecimals
254: * @param string|null $decimalPoint
255: * @return string
256: */
257: public function format(DateTimeInterval $interval, ?string $format = null, ?int $maxDecimals = null, ?string $decimalPoint = null): string
258: {
259: $format = $format ?? $this->format;
260: $maxDecimals = $maxDecimals ?? $this->maxDecimals;
261: $decimalPoint = $decimalPoint ?? $this->decimalPoint;
262:
263: $result = $group = '';
264: $last = null;
265: $escaped = $groupValid = $hasWeeks = false;
266: $characters = str_split($format);
267: $characters[] = '';
268: foreach ($characters as $i => $character) {
269: if ($character === '%' && !$escaped) {
270: $escaped = true;
271: } elseif ($escaped === false && in_array($character, self::$specialCharacters)) {
272: switch ($character) {
273: // years -------------------------------------------------------------------------------------------
274: case self::YEARS:
275: $years = $interval->getYears();
276: $group .= $years;
277: if ($years !== 0) {
278: $groupValid = true;
279: }
280: break;
281: case self::YEARS_FRACTION:
282: $years = $interval->getYearsFraction();
283: $group .= $this->formatNumber($years, $maxDecimals, $decimalPoint);
284: if ($years !== 0.0) {
285: $groupValid = true;
286: }
287: break;
288: case self::YEARS_WORD:
289: $group .= $this->formatUnit(self::YEARS, $characters[$i + 1], $interval->getYears());
290: break;
291: case self::YEARS_UNIT:
292: $group .= $this->formatUnit(self::YEARS, $characters[$i + 1]);
293: break;
294: // months ------------------------------------------------------------------------------------------
295: case self::MONTHS:
296: $months = $interval->getMonths();
297: $group .= $months;
298: if ($months !== 0) {
299: $groupValid = true;
300: }
301: break;
302: case self::MONTHS_FRACTION:
303: $months = $interval->getMonthsFraction();
304: $group .= $this->formatNumber($months, $maxDecimals, $decimalPoint);
305: if ($months !== 0.0) {
306: $groupValid = true;
307: }
308: break;
309: case self::MONTHS_TOTAL:
310: $months = (int) $interval->getMonthsTotal();
311: $group .= $months;
312: if ($months !== 0) {
313: $groupValid = true;
314: }
315: break;
316: case self::MONTHS_TOTAL_FRACTION:
317: $group .= $this->formatNumber($interval->getMonthsTotal(), $maxDecimals, $decimalPoint);
318: break;
319: case self::MONTHS_WORD:
320: $months = $last === self::MONTHS_TOTAL || $last === self::MONTHS_TOTAL_FRACTION
321: ? (int) $interval->getMonthsTotal()
322: : $interval->getMonths();
323: $group .= $this->formatUnit(self::MONTHS, $characters[$i + 1], $months);
324: break;
325: case self::MONTHS_UNIT:
326: $group .= $this->formatUnit(self::MONTHS, $characters[$i + 1]);
327: break;
328: // weeks -------------------------------------------------------------------------------------------
329: case self::WEEKS:
330: $weeks = $interval->getWeeks();
331: $group .= $weeks;
332: if ($weeks !== 0) {
333: $groupValid = true;
334: }
335: $hasWeeks = true;
336: break;
337: case self::WEEKS_FRACTION:
338: $weeks = $interval->getWeeksFraction();
339: $group .= $this->formatNumber($weeks, $maxDecimals, $decimalPoint);
340: if ($weeks !== 0.0) {
341: $groupValid = true;
342: }
343: $hasWeeks = true;
344: break;
345: case self::WEEKS_TOTAL:
346: $weeks = (int) $interval->getWeeksTotal();
347: $group .= $weeks;
348: if ($weeks !== 0) {
349: $groupValid = true;
350: }
351: $hasWeeks = true;
352: break;
353: case self::WEEKS_TOTAL_FRACTION:
354: $weeks = $interval->getWeeksTotal();
355: $group .= $this->formatNumber($weeks, $maxDecimals, $decimalPoint);
356: if ($weeks !== 0.0) {
357: $groupValid = true;
358: }
359: $hasWeeks = true;
360: break;
361: case self::WEEKS_WORD:
362: $weeks = $last === self::WEEKS_TOTAL || $last === self::WEEKS_TOTAL_FRACTION
363: ? (int) $interval->getWeeksTotal()
364: : $interval->getWeeks();
365: $group .= $this->formatUnit(self::WEEKS, $characters[$i + 1], $weeks);
366: break;
367: case self::WEEKS_UNIT:
368: $group .= $this->formatUnit(self::WEEKS, $characters[$i + 1]);
369: break;
370: // days --------------------------------------------------------------------------------------------
371: case self::DAYS:
372: $days = $hasWeeks ? ($interval->getDays() - $interval->getWeeks() * 7) : $interval->getDays();
373: $group .= $days;
374: if ($days !== 0) {
375: $groupValid = true;
376: }
377: break;
378: case self::DAYS_FRACTION:
379: $days = $hasWeeks ? ($interval->getDaysFraction() - $interval->getWeeks() * 7) : $interval->getDaysFraction();
380: $group .= $this->formatNumber($days, $maxDecimals, $decimalPoint);
381: if ($days !== 0.0) {
382: $groupValid = true;
383: }
384: break;
385: case self::DAYS_TOTAL:
386: $days = (int) $interval->getDaysTotal();
387: $group .= $days;
388: if ($days !== 0) {
389: $groupValid = true;
390: }
391: break;
392: case self::DAYS_TOTAL_FRACTION:
393: $days = $interval->getDaysTotal();
394: $group .= $this->formatNumber($days, $maxDecimals, $decimalPoint);
395: if ($days !== 0.0) {
396: $groupValid = true;
397: }
398: break;
399: case self::DAYS_WORD:
400: $days = $last === self::DAYS_TOTAL || $last === self::DAYS_TOTAL_FRACTION
401: ? (int) ($hasWeeks ? ($interval->getDaysFraction() - $interval->getWeeks() * 7) : $interval->getDaysFraction())
402: : ($hasWeeks ? ($interval->getDays() - $interval->getWeeks() * 7) : $interval->getDays());
403: $group .= $this->formatUnit(self::DAYS, $characters[$i + 1], $days);
404: break;
405: case self::DAYS_UNIT:
406: $group .= $this->formatUnit(self::DAYS, $characters[$i + 1]);
407: break;
408: // hours -------------------------------------------------------------------------------------------
409: case self::HOURS:
410: $hours = $interval->getHours();
411: $group .= $hours;
412: if ($hours !== 0) {
413: $groupValid = true;
414: }
415: break;
416: case self::HOURS_FRACTION:
417: $hours = $interval->getHoursFraction();
418: $group .= $this->formatNumber($hours, $maxDecimals, $decimalPoint);
419: if ($hours !== 0.0) {
420: $groupValid = true;
421: }
422: break;
423: case self::HOURS_TOTAL:
424: $hours = (int) $interval->getHoursTotal();
425: $group .= $hours;
426: if ($hours !== 0) {
427: $groupValid = true;
428: }
429: break;
430: case self::HOURS_TOTAL_FRACTION:
431: $hours = $interval->getHoursTotal();
432: $group .= $this->formatNumber($hours, $maxDecimals, $decimalPoint);
433: if ($hours !== 0.0) {
434: $groupValid = true;
435: }
436: break;
437: case self::HOURS_WORD:
438: $hours = $last === self::HOURS_TOTAL || $last === self::HOURS_TOTAL_FRACTION
439: ? (int) $interval->getHoursTotal()
440: : $interval->getHours();
441: $group .= $this->formatUnit(self::HOURS, $characters[$i + 1], $hours);
442: break;
443: case self::HOURS_UNIT:
444: $group .= $this->formatUnit(self::HOURS, $characters[$i + 1]);
445: break;
446: // minutes -----------------------------------------------------------------------------------------
447: case self::MINUTES:
448: $minutes = $interval->getMinutes();
449: $group .= $minutes;
450: if ($minutes !== 0) {
451: $groupValid = true;
452: }
453: break;
454: case self::MINUTES_FRACTION:
455: $minutes = $interval->getMinutesFraction();
456: $group .= $this->formatNumber($minutes, $maxDecimals, $decimalPoint);
457: if ($minutes !== 0.0) {
458: $groupValid = true;
459: }
460: break;
461: case self::MINUTES_TOTAL:
462: $minutes = (int) $interval->getMinutesTotal();
463: $group .= $minutes;
464: if ($minutes !== 0) {
465: $groupValid = true;
466: }
467: break;
468: case self::MINUTES_TOTAL_FRACTION:
469: $minutes = $interval->getMinutesTotal();
470: $group .= $this->formatNumber($minutes, $maxDecimals, $decimalPoint);
471: if ($minutes !== 0.0) {
472: $groupValid = true;
473: }
474: break;
475: case self::MINUTES_WORD:
476: $minutes = $last === self::MINUTES_TOTAL || $last === self::MINUTES_TOTAL_FRACTION
477: ? (int) $interval->getMinutesTotal()
478: : $interval->getMinutes();
479: $group .= $this->formatUnit(self::MINUTES, $characters[$i + 1], $minutes);
480: break;
481: case self::MINUTES_UNIT:
482: $group .= $this->formatUnit(self::MINUTES, $characters[$i + 1]);
483: break;
484: // seconds -----------------------------------------------------------------------------------------
485: case self::SECONDS:
486: $seconds = $interval->getSeconds();
487: $group .= $seconds;
488: if ($seconds !== 0) {
489: $groupValid = true;
490: }
491: break;
492: case self::SECONDS_FRACTION:
493: $seconds = $interval->getSecondsFraction();
494: $group .= $this->formatNumber($seconds, $maxDecimals, $decimalPoint);
495: if ($seconds !== 0.0) {
496: $groupValid = true;
497: }
498: break;
499: case self::SECONDS_TOTAL:
500: $seconds = (int) $interval->getSecondsTotal();
501: $group .= $seconds;
502: if ($seconds !== 0) {
503: $groupValid = true;
504: }
505: break;
506: case self::SECONDS_TOTAL_FRACTION:
507: $seconds = $interval->getSecondsTotal();
508: $group .= $this->formatNumber($seconds, $maxDecimals, $decimalPoint);
509: if ($seconds !== 0.0) {
510: $groupValid = true;
511: }
512: break;
513: case self::SECONDS_WORD:
514: $seconds = $last === self::SECONDS_TOTAL || $last === self::SECONDS_TOTAL_FRACTION
515: ? (int) $interval->getSecondsTotal()
516: : $interval->getSeconds();
517: $group .= $this->formatUnit(self::SECONDS, $characters[$i + 1], $seconds);
518: break;
519: case self::SECONDS_UNIT:
520: $group .= $this->formatUnit(self::SECONDS, $characters[$i + 1]);
521: break;
522: // microseconds ------------------------------------------------------------------------------------
523: case self::MILISECONDS:
524: $microseconds = (int) ($interval->getMicroseconds() / 1000);
525: $group .= $microseconds;
526: if ($microseconds !== 0) {
527: $groupValid = true;
528: }
529: break;
530: case self::MILISECONDS_TOTAL:
531: $microseconds = (int) ($interval->getMicrosecondsTotal() / 1000);
532: $group .= $microseconds;
533: if ($microseconds !== 0) {
534: $groupValid = true;
535: }
536: break;
537: case self::MILISECONDS_WORD:
538: $group .= $this->formatUnit(self::MILISECONDS, $characters[$i + 1], (int) ($interval->getMicroseconds() / 1000));
539: break;
540: case self::MILISECONDS_UNIT:
541: $group .= $this->formatUnit(self::MILISECONDS, $characters[$i + 1]);
542: break;
543: // microseconds ------------------------------------------------------------------------------------
544: case self::MICROSECONDS:
545: $microseconds = $interval->getMicroseconds();
546: $group .= $microseconds;
547: if ($microseconds !== 0) {
548: $groupValid = true;
549: }
550: break;
551: case self::MICROSECONDS_TOTAL:
552: $microseconds = (int) $interval->getMicrosecondsTotal();
553: $group .= $microseconds;
554: if ($microseconds !== 0) {
555: $groupValid = true;
556: }
557: break;
558: case self::MICROSECONDS_WORD:
559: $group .= $this->formatUnit(self::MICROSECONDS, $characters[$i + 1], $interval->getMicroseconds());
560: break;
561: case self::MICROSECONDS_UNIT:
562: $group .= $this->formatUnit(self::MICROSECONDS, $characters[$i + 1]);
563: break;
564: // groups ------------------------------------------------------------------------------------------
565: case Formatting::NO_ZEROS_GROUP_START:
566: $result .= $group;
567: $group = '';
568: $groupValid = false;
569: break;
570: case Formatting::NO_ZEROS_GROUP_END:
571: if ($groupValid) {
572: $result .= $group;
573: }
574: $group = '';
575: $groupValid = false;
576: break;
577: }
578: $last = $character;
579: $escaped = false;
580: } else {
581: $group .= $character;
582: }
583: }
584:
585: return $result . $group;
586: }
587:
588: private function formatNumber(float $number, int $maxDecimals, string $decimalPoint): string
589: {
590: $number = number_format($number, $maxDecimals, $decimalPoint, '');
591:
592: return rtrim(rtrim($number, '0'), $decimalPoint);
593: }
594:
595: private function formatUnit(string $unit, string $modifier, ?int $number = null): string
596: {
597: $unit = $this->getUnit($unit, $number);
598: switch ($modifier) {
599: case Formatting::UPPER_CASE_MODIFIER:
600: return Str::upper($unit);
601: case Formatting::FIRST_UPPER_MODIFIER:
602: return Str::firstUpper($unit);
603: default:
604: return $unit;
605: }
606: }
607:
608: /**
609: * (Override for other plural rules or use Translator.)
610: * @param string $unit
611: * @param int|null $number
612: * @return string
613: */
614: protected function getUnit(string $unit, ?int $number = null): string
615: {
616: $words = $this->getVocabulary();
617:
618: if ($number === null) {
619: if ($this->translator !== null) {
620: return $this->translator->translate($words[$unit][0]);
621: } else {
622: return $words[$unit][0];
623: }
624: }
625:
626: if ($this->translator !== null) {
627: return $this->translator->translate($words[$unit][1], $number);
628: }
629:
630: if (abs($number) < 2) {
631: return $words[$unit][1];
632: } else {
633: return $words[$unit][2];
634: }
635: }
636:
637: /**
638: * (Override for other default translations.)
639: * @return string[][]
640: */
641: protected function getVocabulary(): array
642: {
643: return [
644: self::YEARS => ['y', 'year', 'years'],
645: self::MONTHS => ['m', 'month', 'months'],
646: self::WEEKS => ['w', 'week', 'weeks'],
647: self::DAYS => ['d', 'day', 'days'],
648: self::HOURS => ['h', 'hour', 'hours'],
649: self::MINUTES => ['m', 'minute', 'minutes'],
650: self::SECONDS => ['s', 'second', 'seconds'],
651: self::MILISECONDS => ['ms', 'milisecond', 'miliseconds'],
652: self::MICROSECONDS => ['µs', 'microsecond', 'microseconds'],
653: ];
654: }
655:
656: }
| 0 % | Time\Interval\TimeInterval.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Time\Interval;
4:
5: use Dogma\Arr;
6: use Dogma\Time\InvalidIntervalException;
7:
8: class TimeInterval implements \Dogma\Time\Interval\DateOrTimeInterval
9: {
10: use \Dogma\StrictBehaviorMixin;
11:
12: public const DEFAULT_FORMAT = 'h:i:S';
13:
14: /** @var int */
15: private $hours;
16:
17: /** @var int */
18: private $minutes;
19:
20: /** @var int */
21: private $seconds;
22:
23: /** @var int */
24: private $microseconds;
25:
26: public function __construct(
27: int $hours,
28: int $minutes = 0,
29: int $seconds = 0,
30: int $microseconds = 0
31: ) {
32: $this->hours = $hours;
33: $this->minutes = $minutes;
34: $this->seconds = $seconds;
35: $this->microseconds = $microseconds;
36: }
37:
38: public static function createFromDateInterval(\DateInterval $interval): self
39: {
40: $self = new static(0);
41: $self->hours = $interval->invert ? -$interval->y : $interval->y;
42: $self->minutes = $interval->invert ? -$interval->m : $interval->m;
43: $self->seconds = $interval->invert ? -$interval->d : $interval->d;
44:
45: if ($interval->h !== 0 || $interval->i !== 0 || $interval->s !== 0 || $interval->f !==0) {
46: throw new InvalidIntervalException($interval->format('%r %y-%m-%d %h-%i-%s.%f'));
47: }
48:
49: return $self;
50: }
51:
52: public static function createFromDateIntervalString(string $string): self
53: {
54: $interval = new \DateInterval($string);
55:
56: return self::createFromDateInterval($interval);
57: }
58:
59: public static function createFromDateString(string $string): self
60: {
61: $interval = \DateInterval::createFromDateString($string);
62:
63: return self::createFromDateInterval($interval);
64: }
65:
66: // queries ---------------------------------------------------------------------------------------------------------
67:
68: public function toDateTimeInterval(): DateTimeInterval
69: {
70: return new DateTimeInterval(0, 0, 0, $this->hours, $this->minutes, $this->seconds, $this->microseconds);
71: }
72:
73: public function toNative(): \DateInterval
74: {
75: return $this->toDateTimeInterval()->toNative();
76: }
77:
78: /**
79: * @return \DateInterval[]
80: */
81: public function toPositiveNegative(): array
82: {
83: return $this->toDateTimeInterval()->toPositiveNegative();
84: }
85:
86: public function format(string $format = self::DEFAULT_FORMAT, ?DateTimeIntervalFormatter $formatter = null): string
87: {
88: if ($formatter === null) {
89: $formatter = new DateTimeIntervalFormatter();
90: }
91:
92: return $formatter->format($this->toDateTimeInterval(), $format);
93: }
94:
95: public function isZero(): bool
96: {
97: return $this->hours === 0
98: && $this->minutes === 0
99: && $this->seconds === 0
100: && $this->microseconds === 0;
101: }
102:
103: public function isMixed(): bool
104: {
105: return !$this->isPositive() && !$this->isNegative();
106: }
107:
108: private function isPositive(): bool
109: {
110: return $this->hours >= 0
111: && $this->minutes >= 0
112: && $this->seconds >= 0
113: && $this->microseconds >= 0;
114: }
115:
116: private function isNegative(): bool
117: {
118: return $this->hours < 0
119: && $this->minutes < 0
120: && $this->seconds < 0
121: && $this->microseconds < 0;
122: }
123:
124: // actions ---------------------------------------------------------------------------------------------------------
125:
126: public function add(self ...$other): self
127: {
128: $that = clone($this);
129: foreach ($other as $interval) {
130: $that->hours += $interval->hours;
131: $that->minutes += $interval->minutes;
132: $that->seconds += $interval->seconds;
133: $that->microseconds += $interval->microseconds;
134: }
135:
136: return $that->normalize();
137: }
138:
139: public function subtract(self ...$other): self
140: {
141: return $this->add(...Arr::map($other, function (DateTimeInterval $interval) {
142: return $interval->invert();
143: }));
144: }
145:
146: public function invert(): self
147: {
148: return new self(-$this->hours, -$this->minutes, -$this->seconds, -$this->microseconds);
149: }
150:
151: public function abs(): self
152: {
153: if ($this->getHoursFraction() >= 0.0) {
154: return $this;
155: } else {
156: return $this->invert();
157: }
158: }
159:
160: /**
161: * Normalizes values by summarizing smaller units into bigger. eg: '34 days' -> '1 month, 4 days'
162: * @return self
163: */
164: public function normalize(): self
165: {
166: $microseconds = $this->microseconds;
167: $seconds = $this->seconds;
168: $minutes = $this->minutes;
169: $hours = $this->hours;
170:
171: if ($microseconds >= 1000000) {
172: $seconds += (int) ($microseconds / 1000000);
173: $microseconds = $microseconds % 1000000;
174: } elseif ($microseconds <= -1000000) {
175: $seconds += (int) ($microseconds / 1000000);
176: $microseconds = $microseconds % 1000000;
177: }
178: if ($seconds >= 60) {
179: $minutes += (int) ($seconds / 60);
180: $seconds = $seconds % 60;
181: } elseif ($seconds <= -60) {
182: $minutes += (int) ($seconds / 60);
183: $seconds = $seconds % 60;
184: }
185: if ($minutes >= 60) {
186: $hours += (int) ($minutes / 60);
187: $minutes = $minutes % 60;
188: } elseif ($minutes <= -60) {
189: $hours += (int) ($minutes / 60);
190: $minutes = $minutes % 60;
191: }
192:
193: return new self($hours, $minutes, $seconds, $microseconds);
194: }
195:
196: // getters ---------------------------------------------------------------------------------------------------------
197:
198: /**
199: * @return int[]
200: */
201: public function getValues(): array
202: {
203: return [
204: $this->hours,
205: $this->minutes,
206: $this->seconds,
207: $this->microseconds,
208: ];
209: }
210:
211: public function getHours(): int
212: {
213: return $this->hours;
214: }
215:
216: public function getHoursTotal(): float
217: {
218: return $this->getHoursFraction();
219: }
220:
221: public function getHoursFraction(): float
222: {
223: return $this->hours
224: + $this->minutes / 60
225: + $this->seconds / 60 / 60
226: + $this->microseconds / 60 / 60 / 1000000;
227: }
228:
229: public function getMinutes(): int
230: {
231: return $this->minutes;
232: }
233:
234: public function getMinutesTotal(): float
235: {
236: return $this->getMinutesFraction()
237: + $this->hours * 60;
238: }
239:
240: public function getMinutesFraction(): float
241: {
242: return $this->minutes
243: + $this->seconds / 60
244: + $this->microseconds / 60 / 1000000;
245: }
246:
247: public function getSeconds(): int
248: {
249: return $this->seconds;
250: }
251:
252: public function getSecondsTotal(): float
253: {
254: return $this->getSecondsFraction()
255: + $this->minutes * 60
256: + $this->hours * 60 * 60;
257: }
258:
259: public function getSecondsFraction(): float
260: {
261: return $this->seconds
262: + $this->microseconds / 1000000;
263: }
264:
265: public function getMicroseconds(): int
266: {
267: return $this->microseconds;
268: }
269:
270: public function getMicrosecondsTotal(): int
271: {
272: return $this->microseconds
273: + $this->seconds * 1000000
274: + $this->minutes * 60 * 1000000
275: + $this->hours * 60 * 60 * 1000000;
276: }
277:
278: }
| 100 % | Time\Mapping\DateTimeHandler.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Mapping;
11:
12: use Dogma\Mapping\Mapper;
13: use Dogma\Time\Date;
14: use Dogma\Time\DateTime;
15: use Dogma\Time\Time;
16: use Dogma\Type;
17:
18: /**
19: * Creates Date/Time/DateTime instances from raw data and vice versa
20: */
21: class DateTimeHandler implements \Dogma\Mapping\Type\Handler
22: {
23: use \Dogma\StrictBehaviorMixin;
24:
25: /** @var string */
26: private $dateTimeFormat;
27:
28: /** @var string */
29: private $dateFormat;
30:
31: /** @var string */
32: private $timeFormat;
33:
34: /** @var \DateTimeZone|null */
35: private $timeZone;
36:
37: public function __construct(
38: string $dateTimeFormat = 'Y-m-d H:i:s',
39: string $dateFormat = 'Y-m-d',
40: string $timeFormat = 'H:i:s',
41: ?\DateTimeZone $timeZone = null
42: )
43: {
44: $this->dateTimeFormat = $dateTimeFormat;
45: $this->dateFormat = $dateFormat;
46: $this->timeFormat = $timeFormat;
47: $this->timeZone = $timeZone;
48: }
49:
50: public function acceptsType(Type $type): bool
51: {
52: return $type->isImplementing(DateTime::class)
53: || $type->isImplementing(Date::class)
54: || $type->isImplementing(Time::class);
55: }
56:
57: /**
58: * @param \Dogma\Type $type
59: * @return \Dogma\Type[]|null
60: */
61: public function getParameters(Type $type): ?array
62: {
63: return null;
64: }
65:
66: /**
67: * @param \Dogma\Type $type
68: * @param mixed $value
69: * @param \Dogma\Mapping\Mapper $mapper
70: * @return \Dogma\Time\DateTime|\Dogma\Time\Date|\Dogma\Time\Time
71: */
72: public function createInstance(Type $type, $value, Mapper $mapper)
73: {
74: return $type->getInstance($value);
75: }
76:
77: /**
78: * @param \Dogma\Type $type
79: * @param \Dogma\Time\DateTime|\Dogma\Time\Date|\Dogma\Time\Time $instance
80: * @param \Dogma\Mapping\Mapper $mapper
81: * @return string
82: */
83: public function exportInstance(Type $type, $instance, Mapper $mapper): string
84: {
85: return $instance->format();
86: }
87:
88: }
| 4 % | Time\Month.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time;
11:
12: class Month extends \Dogma\Enum\IntEnum
13: {
14:
15: public const JANUARY = 1;
16: public const FEBRUARY = 2;
17: public const MARCH = 3;
18: public const APRIL = 4;
19: public const MAY = 5;
20: public const JUNE = 6;
21: public const JULY = 7;
22: public const AUGUST = 8;
23: public const SEPTEMBER = 9;
24: public const OCTOBER = 10;
25: public const NOVEMBER = 11;
26: public const DECEMBER = 12;
27:
28: /**
29: * @return string[]
30: */
31: public static function getNames(): array
32: {
33: return [
34: self::JANUARY => 'january',
35: self::FEBRUARY => 'february',
36: self::MARCH => 'march',
37: self::APRIL => 'april',
38: self::MAY => 'may',
39: self::JUNE => 'june',
40: self::JULY => 'july',
41: self::AUGUST => 'august',
42: self::SEPTEMBER => 'september',
43: self::OCTOBER => 'october',
44: self::NOVEMBER => 'november',
45: self::DECEMBER => 'december',
46: ];
47: }
48:
49: /**
50: * @return string[]
51: */
52: public static function getShortcuts(): array
53: {
54: return [
55: self::JANUARY => 'jan',
56: self::FEBRUARY => 'feb',
57: self::MARCH => 'mar',
58: self::APRIL => 'apr',
59: self::MAY => 'may',
60: self::JUNE => 'jun',
61: self::JULY => 'jul',
62: self::AUGUST => 'aug',
63: self::SEPTEMBER => 'sep',
64: self::OCTOBER => 'oct',
65: self::NOVEMBER => 'nov',
66: self::DECEMBER => 'dec',
67: ];
68: }
69:
70: }
| 0 % | Time\Provider\ConstantTimeProvider.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Provider;
11:
12: use Dogma\Time\Date;
13: use Dogma\Time\DateTime;
14:
15: class ConstantTimeProvider implements \Dogma\Time\Provider\TimeProvider
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var \Dogma\Time\DateTime */
20: private $dateTime;
21:
22: /** @var \DateTimeZone */
23: private $timeZone;
24:
25: public function __construct(?DateTime $dateTime = null, ?\DateTimeZone $timeZone = null)
26: {
27: if ($dateTime === null) {
28: $dateTime = new DateTime();
29: }
30: if ($timeZone === null) {
31: $timeZone = $dateTime->getTimezone();
32: }
33:
34: $this->dateTime = $dateTime;
35: $this->timeZone = $timeZone;
36: }
37:
38: public function getDate(): Date
39: {
40: return $this->dateTime->getDate();
41: }
42:
43: public function getDateTime(): DateTime
44: {
45: return $this->dateTime;
46: }
47:
48: public function getTimeZone(): \DateTimeZone
49: {
50: return $this->timeZone;
51: }
52:
53: }
| 45 % | Time\Provider\CurrentTimeProvider.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Provider;
11:
12: use Dogma\Time\Date;
13: use Dogma\Time\DateTime;
14:
15: class CurrentTimeProvider implements \Dogma\Time\Provider\TimeProvider
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var \DateTimeZone|null */
20: private $timeZone;
21:
22: public function __construct(?\DateTimeZone $timeZone = null)
23: {
24: $this->timeZone = $timeZone;
25: }
26:
27: public function getDate(): Date
28: {
29: return $this->getDateTime()->getDate();
30: }
31:
32: public function getDateTime(): DateTime
33: {
34: $currentTime = new DateTime();
35:
36: if ($this->timeZone !== null) {
37: return $currentTime->setTimezone($this->timeZone);
38: }
39:
40: return $currentTime;
41: }
42:
43: public function getTimeZone(): \DateTimeZone
44: {
45: return $this->timeZone ?? $this->getDateTime()->getTimezone();
46: }
47:
48: }
| 100 % | Time\Provider\TimeProvider.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Provider;
11:
12: use Dogma\Time\Date;
13: use Dogma\Time\DateTime;
14:
15: interface TimeProvider
16: {
17:
18: public function getDate(): Date;
19:
20: public function getDateTime(): DateTime;
21:
22: public function getTimeZone(): \DateTimeZone;
23:
24: }
| 100 % | Time\Range\DateOrTimeRange.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Time\Range;
4:
5: use Dogma\Time\Interval\DateTimeInterval;
6:
7: interface DateOrTimeRange/*<T>*/ extends \Dogma\Math\Range\Range/*<T>*/, \Dogma\Equalable, \Dogma\Comparable
8: {
9:
10: public function getInterval(): DateTimeInterval;
11:
12: //public function splitByUnit(DateTimeUnit $unit): DateOrTimeRangeSet;//<T>
13:
14: }
| 0 % | Time\Range\DateOrTimeRangeSet.php |
<?php declare(strict_types=1);
2:
3: namespace Dogma\Time\Range;
4:
5: interface DateOrTimeRangeSet/*<T>*/ extends \Dogma\Math\Range\RangeSet//<T>
6: {
7:
8: }
| 95 % | Time\Range\DateRange.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Range;
11:
12: use Dogma\Arr;
13: use Dogma\Check;
14: use Dogma\Comparable;
15: use Dogma\Equalable;
16: use Dogma\Math\Range\IntRange;
17: use Dogma\Time\Date;
18: use Dogma\Time\DateTimeUnit;
19: use Dogma\Time\Interval\DateInterval;
20: use Dogma\Time\Interval\DateTimeInterval;
21:
22: class DateRange implements \Dogma\Time\Range\DateOrTimeRange
23: {
24: use \Dogma\StrictBehaviorMixin;
25:
26: public const MIN = Date::MIN;
27: public const MAX = Date::MAX;
28:
29: public const DEFAULT_FORMAT = 'Y-m-d| - Y-m-d';
30:
31: /** @var \Dogma\Time\Date */
32: private $start;
33:
34: /** @var \Dogma\Time\Date */
35: private $end;
36:
37: public function __construct(Date $start, Date $end)
38: {
39: $this->start = $start;
40: $this->end = $end;
41: }
42:
43: public static function createFromDayNumberIntRange(IntRange $range): self
44: {
45: return new static(Date::createFromDayNumber($range->getStart()), Date::createFromDayNumber($range->getEnd()));
46: }
47:
48: public static function createFromTimestampIntRange(IntRange $range): self
49: {
50: return new static(Date::createFromTimestamp($range->getStart()), Date::createFromTimestamp($range->getEnd()));
51: }
52:
53: public static function createEmpty(): self
54: {
55: $range = new static(new Date(), new Date());
56: $range->start = new Date(self::MAX);
57: $range->end = new Date(self::MIN);
58:
59: return $range;
60: }
61:
62: public static function createAll(): self
63: {
64: return new static(new Date(self::MIN), new Date(self::MAX));
65: }
66:
67: // modifications ---------------------------------------------------------------------------------------------------
68:
69: public function modify(string $value): self
70: {
71: return new static($this->start->modify($value), $this->end->modify($value));
72: }
73:
74: // queries ---------------------------------------------------------------------------------------------------------
75:
76: public function getInterval(): DateTimeInterval
77: {
78: return DateTimeInterval::createFromDateInterval($this->start->diff($this->end));
79: }
80:
81: public function getDateInterval(): DateInterval
82: {
83: return DateInterval::createFromDateInterval($this->start->diff($this->end));
84: }
85:
86: public function toDayNumberIntRange(): IntRange
87: {
88: return new IntRange($this->start->getDayNumber(), $this->end->getDayNumber());
89: }
90:
91: public function toTimestampIntRange(): IntRange
92: {
93: return new IntRange($this->start->getStart()->getTimestamp(), $this->end->getStart()->getTimestamp());
94: }
95:
96: public function format(string $format = self::DEFAULT_FORMAT, ?SmartDateTimeRangeFormatter $formatter = null): string
97: {
98: if ($formatter === null) {
99: $formatter = new SimpleDateTimeRangeFormatter();
100: }
101:
102: return $formatter->format($this, $format);
103: }
104:
105: public function getStart(): Date
106: {
107: return $this->start;
108: }
109:
110: public function getEnd(): Date
111: {
112: return $this->end;
113: }
114:
115: public function isEmpty(): bool
116: {
117: return $this->start > $this->end;
118: }
119:
120: public function equals(Equalable $other): bool
121: {
122: $other instanceof self or Check::object($other, self::class);
123:
124: return $this->start->equals($other->start) && $this->end->equals($other->end);
125: }
126:
127: public function compare(Comparable $other): int
128: {
129: $other instanceof self or Check::object($other, self::class);
130:
131: return $this->start->compare($other) ?: $this->end->compare($other);
132: }
133:
134: /**
135: * @param \Dogma\Time\Date|\DateTimeInterface $date
136: * @return bool
137: */
138: public function containsValue($date): bool
139: {
140: if (!$date instanceof Date) {
141: $date = Date::createFromDateTimeInterface($date);
142: }
143:
144: return $date->isBetween($this->start, $this->end);
145: }
146:
147: public function contains(self $range): bool
148: {
149: return !$range->isEmpty() && $this->start->isSameOrBefore($range->start) && $this->end->isSameOrAfter($range->end);
150: }
151:
152: public function intersects(self $range): bool
153: {
154: return $this->containsValue($range->start) || $this->containsValue($range->end);
155: }
156:
157: public function touches(self $range): bool
158: {
159: return $this->start->equals($range->end->increment()) || $this->end->equals($range->start->decrement());
160: }
161:
162: // actions ---------------------------------------------------------------------------------------------------------
163:
164: public function split(int $parts): DateRangeSet
165: {
166: Check::min($parts, 1);
167:
168: if ($this->isEmpty()) {
169: return new DateRangeSet([]);
170: }
171:
172: $partSize = ($this->end->getDayNumber() - $this->start->getDayNumber() + 1) / $parts;
173: $rangeStarts = [];
174: for ($n = 1; $n < $parts; $n++) {
175: $rangeStarts[] = (int) round($this->start->getDayNumber() + $partSize * $n);
176: }
177: $rangeStarts = array_unique($rangeStarts);
178: $rangeStarts = Arr::map($rangeStarts, function (int $dayNumber) {
179: return Date::createFromDayNumber($dayNumber);
180: });
181:
182: return $this->splitBy($rangeStarts);
183: }
184:
185: /**
186: * @param \Dogma\Time\Date $rangeStarts
187: * @return \Dogma\Time\Range\DateRangeSet
188: */
189: public function splitBy(array $rangeStarts): DateRangeSet
190: {
191: if ($this->isEmpty()) {
192: return new DateRangeSet([]);
193: }
194:
195: $rangeStarts = Arr::sort($rangeStarts);
196: $results = [$this];
197: $i = 0;
198: /** @var \Dogma\Time\Date $rangeStart */
199: foreach ($rangeStarts as $rangeStart) {
200: $range = $results[$i];
201: if ($range->containsValue($rangeStart) && $range->containsValue($rangeStart->decrement())) {
202: $results[$i] = new static($range->start, $rangeStart->decrement());
203: $results[] = new static($rangeStart, $range->end);
204: $i++;
205: }
206: }
207:
208: return new DateRangeSet($results);
209: }
210:
211: public function splitByUnit(DateTimeUnit $unit, int $amount = 1): DateRangeSet
212: {
213: ///
214: }
215:
216: public function envelope(self ...$items): self
217: {
218: $items[] = $this;
219: $start = Date::MAX_DAY_NUMBER;
220: $end = Date::MIN_DAY_NUMBER;
221: foreach ($items as $item) {
222: $startValue = $item->start->getDayNumber();
223: if ($startValue < $start) {
224: $start = $startValue;
225: }
226: $endValue = $item->end->getDayNumber();
227: if ($endValue > $end) {
228: $end = $endValue;
229: }
230: }
231:
232: return new static(new Date($start), new Date($end));
233: }
234:
235: public function intersect(self ...$items): self
236: {
237: $items[] = $this;
238: $items = self::sort($items);
239:
240: $result = array_shift($items);
241: /** @var \Dogma\Time\Range\DateRange $item */
242: foreach ($items as $item) {
243: if ($result->end->isSameOrAfter($item->start)) {
244: $result = new static(Date::max($result->start, $item->start), Date::min($result->end, $item->end));
245: } else {
246: return static::createEmpty();
247: }
248: }
249:
250: return $result;
251: }
252:
253: public function union(self ...$items): DateRangeSet
254: {
255: $items[] = $this;
256: $items = self::sortByStart($items);
257:
258: $current = array_shift($items);
259: $results = [$current];
260: /** @var self $item */
261: foreach ($items as $item) {
262: if ($item->isEmpty()) {
263: continue;
264: }
265: if ($current->end->isSameOrAfter($item->start->decrement())) {
266: $current = new static($current->start, Date::max($current->end, $item->end));
267: $results[count($results) - 1] = $current;
268: } else {
269: $current = $item;
270: $results[] = $current;
271: }
272: }
273:
274: return new DateRangeSet($results);
275: }
276:
277: public function difference(self ...$items): DateRangeSet
278: {
279: $items[] = $this;
280: $overlaps = self::countOverlaps(...$items);
281:
282: $results = [];
283: foreach ($overlaps as $i => [$item, $count]) {
284: if ($count === 1) {
285: $results[] = $item;
286: }
287: }
288:
289: return new DateRangeSet($results);
290: }
291:
292: public function subtract(self ...$items): DateRangeSet
293: {
294: $ranges = [$this];
295:
296: foreach ($items as $item) {
297: if ($item->isEmpty()) {
298: continue;
299: }
300: /** @var \Dogma\Time\Range\DateRange $range */
301: foreach ($ranges as $r => $range) {
302: unset($ranges[$r]);
303: if ($range->start->isBefore($item->start) && $range->end->isAfter($item->end)) {
304: $ranges[] = new static($range->start, $item->start->decrement());
305: $ranges[] = new static($item->end->increment(), $range->end);
306: } elseif ($range->start->isBefore($item->start)) {
307: $ranges[] = new static($range->start, Date::min($range->end, $item->start->decrement()));
308: } elseif ($range->end->isAfter($item->end)) {
309: $ranges[] = new static(Date::max($range->start, $item->end->increment()), $range->end);
310: }
311: }
312: }
313: if ($ranges === []) {
314: $ranges[] = DateRange::createEmpty();
315: }
316:
317: return new DateRangeSet(array_values($ranges));
318: }
319:
320: public function invert(): DateRangeSet
321: {
322: return self::createAll()->subtract($this);
323: }
324:
325: // static ----------------------------------------------------------------------------------------------------------
326:
327: /**
328: * @param \Dogma\Time\Range\DateRange[] ...$items
329: * @return \Dogma\Time\Range\DateRange[][]|int[][] ($range, $count)
330: */
331: public static function countOverlaps(self ...$items): array
332: {
333: $overlaps = self::explodeOverlaps(...$items);
334:
335: $results = [];
336: /** @var \Dogma\Time\Range\DateRange $overlap */
337: foreach ($overlaps as $overlap) {
338: $ident = $overlap->toDayNumberIntRange()->format();
339: if (isset($results[$ident])) {
340: $results[$ident][1]++;
341: } else {
342: $results[$ident] = [$overlap, 1];
343: }
344: }
345:
346: return array_values($results);
347: }
348:
349: /**
350: * @param \Dogma\Time\Range\DateRange ...$items
351: * @return \Dogma\Time\Range\DateRange[]
352: */
353: public static function explodeOverlaps(self ...$items): array
354: {
355: $items = self::sort($items);
356: $i = 0;
357: while (isset($items[$i])) {
358: $a = $items[$i];
359: /** @var \Dogma\Math\Range\IntRange $b */
360: foreach ($items as $b) {
361: if ($a->isEmpty()) {
362: unset($items[$i]);
363: } elseif ($a->end->isBefore($b->start) || $a->start->isAfter($b->end)) {
364: // a1----a1 b1----b1
365: } elseif ($a->start->equals($b->start)) {
366: if ($a->end->equals($b->end)) {
367: // a1=b1----a2=b2
368: } elseif ($a->end->isAfter($b->end)) {
369: // a1=b1----b2----a2
370: $items[$i] = $b;
371: $items[] = new static($b->end->increment(), $a->end);
372: $a = $b;
373: } else {
374: // a1=b1----a2----b2
375: }
376: } elseif ($a->start->isBefore($b->start)) {
377: if ($a->end->equals($b->end)) {
378: // a1----b1----a2=b2
379: $items[$i] = $b;
380: $items[] = new static($a->start, $b->start->decrement());
381: $a = $b;
382: } elseif ($a->end->isAfter($b->end)) {
383: // a1----b1----b2----a2
384: $items[$i] = $b;
385: $items[] = new static($a->start, $b->start->decrement());
386: $items[] = new static($b->end->increment(), $a->end);
387: $a = $b;
388: } else {
389: // a1----b1----a2----b2
390: $new = new static($b->start, $a->end);
391: $items[$i] = $new;
392: $items[] = new static($a->start, $b->start->decrement());
393: $a = $new;
394: }
395: } else {
396: if ($a->end->equals($b->end)) {
397: // b1----a1----a2=b2
398: } elseif ($a->end->isAfter($b->end)) {
399: // b1----a1----b2----a2
400: $new = new static($a->start, $b->end);
401: $items[$i] = $new;
402: $items[] = new static($b->end->increment(), $a->end);
403: $a = $new;
404: } else {
405: // b1----a1----a2----b2
406: }
407: }
408: }
409: $i++;
410: }
411:
412: return array_values(self::sort($items));
413: }
414:
415: /**
416: * @param self[] $ranges
417: * @return self[]
418: */
419: public static function sort(array $ranges): array
420: {
421: return Arr::sortWith($ranges, function (DateRange $a, DateRange $b) {
422: return $a->start->getDayNumber() <=> $b->start->getDayNumber() ?: $a->end->getDayNumber() <=> $b->end->getDayNumber();
423: });
424: }
425:
426: /**
427: * @param self[] $ranges
428: * @return self[]
429: */
430: public static function sortByStart(array $ranges): array
431: {
432: return Arr::sortWith($ranges, function (DateRange $a, DateRange $b) {
433: return $a->start->getDayNumber() <=> $b->start->getDayNumber();
434: });
435: }
436:
437: }
| 56 % | Time\Range\DateRangeSet.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Time\Range;
4:
5: use Dogma\Arr;
6: use Dogma\Check;
7: use Dogma\Equalable;
8:
9: class DateRangeSet implements \Dogma\Equalable
10: {
11: use \Dogma\StrictBehaviorMixin;
12:
13: /** @var \Dogma\Time\Range\DateRange[] */
14: private $ranges;
15:
16: /**
17: * @param \Dogma\Math\Range\IntRange[] $ranges
18: */
19: public function __construct(array $ranges)
20: {
21: Check::itemsOfType($ranges, DateRange::class);
22:
23: $this->ranges = $ranges;
24: }
25:
26: public function format(string $format = DateRange::DEFAULT_FORMAT, ?DateTimeRangeFormatter $formatter = null): string
27: {
28: return implode(', ', Arr::map($this->ranges, function (DateRange $dateRange) use ($format, $formatter): string {
29: return $dateRange->format($format, $formatter);
30: }));
31: }
32:
33: /**
34: * @return \Dogma\Time\Range\DateRange[]
35: */
36: public function getRanges(): array
37: {
38: return $this->ranges;
39: }
40:
41: public function isEmpty(): bool
42: {
43: return $this->ranges === [];
44: }
45:
46: public function equals(Equalable $other): bool
47: {
48: $other instanceof self or Check::object($other, self::class);
49:
50: $otherRanges = $other->getRanges();
51: if (count($this->ranges) !== count($otherRanges)) {
52: return false;
53: }
54: foreach ($this->ranges as $i => $range) {
55: if (!$range->equals($otherRanges[$i])) {
56: return false;
57: }
58: }
59:
60: return true;
61: }
62:
63: public function contains(int $value): bool
64: {
65: foreach ($this->ranges as $range) {
66: if ($range->contains($value)) {
67: return true;
68: }
69: }
70:
71: return false;
72: }
73:
74: public function envelope(): DateRange
75: {
76: if ($this->ranges === []) {
77: return DateRange::createEmpty();
78: } else {
79: return DateRange::envelope(...$this->ranges);
80: }
81: }
82:
83: }
| 0 % | Time\Range\DateTimeRange.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Range;
11:
12: use Dogma\Check;
13: use Dogma\Comparable;
14: use Dogma\Equalable;
15: use Dogma\Time\DateTime;
16: use Dogma\Time\Interval\DateTimeInterval;
17:
18: class DateTimeRange implements \Dogma\Time\Range\DateOrTimeRange, \Dogma\Equalable, \Dogma\Comparable
19: {
20: use \Dogma\StrictBehaviorMixin;
21:
22: public const MIN = DateTime::MIN;
23: public const MAX = DateTime::MAX;
24:
25: /** @var \Dogma\Time\DateTime */
26: private $start;
27:
28: /** @var \Dogma\Time\DateTime */
29: private $end;
30:
31: public function __construct(DateTime $start, DateTime $end)
32: {
33: $this->start = $start;
34: $this->end = $end;
35: }
36:
37: public static function createEmpty(): self
38: {
39: ///
40: }
41:
42: public static function createAll(): self
43: {
44: ///
45: }
46:
47: public function getInterval(): DateTimeInterval
48: {
49: return DateTimeInterval::createFromDateInterval($this->start->diff($this->end));
50: }
51:
52: public function getStart(): DateTime
53: {
54: return $this->start;
55: }
56:
57: public function getEnd(): DateTime
58: {
59: return $this->end;
60: }
61:
62: public function isEmpty(): bool
63: {
64: ///
65: }
66:
67: public function equals(Equalable $other): bool
68: {
69: $other instanceof self or Check::object($other, self::class);
70:
71: return $this->start->equals($other->start) && $this->end->equals($other->end);
72: }
73:
74: public function compare(Comparable $other): int
75: {
76: $other instanceof self or Check::object($other, self::class);
77:
78: return $this->start->compare($other->start) ?: $this->end->compare($other->end);
79: }
80:
81: /**
82: * @param \Dogma\Time\Date|\DateTimeInterface $date
83: * @return bool
84: */
85: public function contains($date): bool
86: {
87: ///
88: return false;
89: }
90:
91: public function containsRange(self $range): bool
92: {
93: ///
94: }
95:
96: public function intersects(self $range): bool
97: {
98: ///
99: }
100:
101: public function partition(int $parts): DateRangeSet
102: {
103: ///
104: }
105:
106: public function partitionBy(int ...$borders): DateRangeSet
107: {
108: ///
109: }
110:
111: public function envelope(self ...$items): self
112: {
113: ///
114: }
115:
116: public function intersect(self ...$items): self
117: {
118: ///
119: }
120:
121: public function union(self ...$items): DateRangeSet
122: {
123: ///
124: }
125:
126: public function difference(self ...$items): DateRangeSet
127: {
128: ///
129: }
130:
131: public function subtract(self ...$items): DateRangeSet
132: {
133: ///
134: }
135:
136: public function invert(): DateRangeSet
137: {
138: ///
139: }
140:
141: /**
142: * @param \Dogma\Time\Range\DateTimeRange ...$items
143: * @return \Dogma\Time\Range\DateTimeRange[][]|int[][] ($range, $count)
144: */
145: public static function countOverlaps(self ...$items): array
146: {
147: ///
148: }
149:
150: /**
151: * @param \Dogma\Time\Range\DateTimeRange ...$items
152: * @return \Dogma\Time\Range\DateTimeRange[]
153: */
154: public static function explodeOverlaps(self ...$items): array
155: {
156: ///
157: }
158:
159: }
| 0 % | Time\Range\DateTimeRangeFormatter.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Time\Range;
4:
5: interface DateTimeRangeFormatter
6: {
7:
8: public const START_END_SEPARATOR = '|';
9:
10: /**
11: * @param \Dogma\Time\Range\DateOrTimeRange $range
12: * @param string|null $format
13: * @return string
14: */
15: public function format(DateOrTimeRange $range, ?string $format = null): string;
16:
17: }
| 0 % | Time\Range\SimpleDateTimeRangeFormatter.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Time\Range;
4:
5: /**
6: * Uses standard PHP date() formatting and "|" separator for start and end part of formatting string.
7: */
8: class SimpleDateTimeRangeFormatter implements \Dogma\Time\Range\DateTimeRangeFormatter
9: {
10:
11: public function format(DateOrTimeRange $range, ?string $format = null): string
12: {
13: $parts = explode(self::START_END_SEPARATOR, $format);
14: if (count($parts) !== 2) {
15: throw new \Dogma\Time\InvalidFormattingStringException(
16: sprintf('Format string "%s" should contain exactly one "|" separator, to distinguish format for start and end date/time.', $format)
17: );
18: }
19: [$startFormat, $endFormat] = $parts;
20:
21: if ($range instanceof DateRange) {
22: $start = $range->getStart()->toDateTime();
23: $end = $range->getEnd()->toDateTime();
24: } elseif ($range instanceof TimeRange) {
25: $start = $range->getStart()->toDateTime();
26: $end = $range->getEnd()->toDateTime();
27: } else {
28: $start = $range->getStart();
29: $end = $range->getEnd();
30: }
31:
32: return $start->format($startFormat) . $end->format($endFormat);
33: }
34:
35: }
| 0 % | Time\Range\SmartDateTimeRangeFormatter.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Range;
11:
12: class SmartDateTimeRangeFormatter implements \Dogma\Time\Range\DateTimeRangeFormatter
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /**
17: * "d. n*({ Y})[ H:i]|{ - d. n*( Y)[ H:i]}"
18: * "d. m.({ Y}) h:I| - h:I"
19: *
20: * Ch. Description
21: * ---- ---------------------------------------
22: * Escaping:
23: * % Escape character. Use %% for printing "%"
24: *
25: * Range:
26: * | Logical separator of since and until date. Not printed in result
27: *
28: * Skip groups:
29: * [ Group start, skip if zero
30: * ] Group end, skip if zero
31: * ( Group start, skip if same as today
32: * ) Group end, skip if same as today
33: * { Group start, skip if same for both
34: * } Group end, skip if same for both
35: *
36: * For modifiers and objects @see DateTimeFormatter::format()
37: *
38: * @param \Dogma\Time\Range\DateOrTimeRange $range
39: * @param string|null $format
40: * @return string
41: */
42: public function format(DateOrTimeRange $range, ?string $format = null): string
43: {
44: $parts = explode(self::START_END_SEPARATOR, $format);
45: if (count($parts) !== 2) {
46: throw new \Dogma\Time\InvalidFormattingStringException(
47: sprintf('Format string "%s" should contain exactly one "|" separator, to distinguish format for since and until date.', $format)
48: );
49: }
50: [$sinceFormat, $untilFormat] = $parts;
51:
52: ///
53: return '';
54: }
55:
56: /**
57: * @param \Dogma\Time\Range\DateTimeRange|\Dogma\Time\Range\DateRange|\Dogma\Time\Range\TimeRange
58: * @return string
59: */
60: public function formatRange($range): string
61: {
62: ///
63: return '';
64: }
65:
66: }
| 0 % | Time\Range\TimeRange.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time\Range;
11:
12: use Dogma\Check;
13: use Dogma\Comparable;
14: use Dogma\Equalable;
15: use Dogma\Time\Interval\DateTimeInterval;
16: use Dogma\Time\Interval\TimeInterval;
17: use Dogma\Time\Time;
18:
19: class TimeRange implements \Dogma\Time\Range\DateOrTimeRange
20: {
21: use \Dogma\StrictBehaviorMixin;
22:
23: public const MIN = Time::MIN;
24: public const MAX = Time::MAX;
25:
26: public const DEFAULT_FORMAT = 'H:i:s.u| - H:i:s.u';
27:
28: /** @var \Dogma\Time\Time */
29: private $start;
30:
31: /** @var \Dogma\Time\Time */
32: private $end;
33:
34: public function __construct(Time $start, Time $end)
35: {
36: $this->start = $start;
37: $this->end = $end;
38: }
39:
40: public static function createEmpty(): self
41: {
42: ///
43: }
44:
45: public static function createAll(): self
46: {
47: ///
48: }
49:
50: // queries ---------------------------------------------------------------------------------------------------------
51:
52: public function getInterval(): DateTimeInterval
53: {
54: return DateTimeInterval::createFromDateInterval($this->end->diff($this->start));
55: }
56:
57: public function getTimeInterval(): TimeInterval
58: {
59: return TimeInterval::createFromDateInterval($this->start->diff($this->end));
60: }
61:
62: public function format(): string
63: {
64: ///
65: }
66:
67: public function getStart(): Time
68: {
69: return $this->start;
70: }
71:
72: public function getEnd(): Time
73: {
74: return $this->end;
75: }
76:
77: public function isEmpty(): bool
78: {
79: ///
80: }
81:
82: public function equals(Equalable $other): bool
83: {
84: $other instanceof self or Check::object($other, self::class);
85:
86: return $this->start->equals($other->start) && $this->end->equals($other->end);
87: }
88:
89: public function compare(Comparable $other): int
90: {
91: $other instanceof self or Check::object($other, self::class);
92:
93: return $this->start->compare($other->start) ?: $this->end->compare($other->end);
94: }
95:
96: public function containsValue(Time $value): bool
97: {
98: ///
99: }
100:
101: public function contains(self $range): bool
102: {
103: ///
104: }
105:
106: public function intersects(self $range): bool
107: {
108: ///
109: }
110:
111: public function touches(self $range): bool
112: {
113: ///
114: }
115:
116: // actions ---------------------------------------------------------------------------------------------------------
117:
118: public function split(int $parts): DateRangeSet
119: {
120: ///
121: return new DateRangeSet([]);
122: }
123:
124: /**
125: * @param \Dogma\Time\Date $borders
126: * @return \Dogma\Time\Range\DateRangeSet
127: */
128: public function splitBy(array $borders): DateRangeSet
129: {
130: ///
131: return new DateRangeSet([]);
132: }
133:
134: public function envelope(self ...$items): self
135: {
136: ///
137: return $this;
138: }
139:
140: public function intersect(self ...$items): self
141: {
142: ///
143: return $this;
144: }
145:
146: public function union(self ...$items): DateRangeSet
147: {
148: ///
149: return new DateRangeSet([]);
150: }
151:
152: public function difference(self ...$items): DateRangeSet
153: {
154: ///
155: return new DateRangeSet([]);
156: }
157:
158: public function subtract(self ...$items): DateRangeSet
159: {
160: ///
161: return new DateRangeSet([]);
162: }
163:
164: public function invert(): DateRangeSet
165: {
166: ///
167: return new DateRangeSet([]);
168: }
169:
170: // static ----------------------------------------------------------------------------------------------------------
171:
172: /**
173: * @param \Dogma\Time\Range\TimeRange ...$items
174: * @return \Dogma\Time\Range\TimeRange[][]|int[][] ($range, $count)
175: */
176: public static function countOverlaps(self ...$items): array
177: {
178: ///
179: return [];
180: }
181:
182: /**
183: * @param \Dogma\Time\Range\TimeRange ...$items
184: * @return \Dogma\Time\Range\TimeRange[]
185: */
186: public static function explodeOverlaps(self ...$items): array
187: {
188: ///
189: return [];
190: }
191:
192: /**
193: * @param self[] $ranges
194: * @return self[]
195: */
196: public static function sort(array $ranges): array
197: {
198: ///
199: }
200:
201: /**
202: * @param self[] $ranges
203: * @return self[]
204: */
205: public static function sortByStart(array $ranges): array
206: {
207: ///
208: }
209:
210: }
| 87 % | Time\Time.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Time;
11:
12: use Dogma\Check;
13: use Dogma\Comparable;
14: use Dogma\Equalable;
15:
16: /**
17: * Time of day.
18: */
19: class Time implements \Dogma\NonIterable, \Dogma\Equalable, \Dogma\Comparable
20: {
21: use \Dogma\StrictBehaviorMixin;
22: use \Dogma\NonIterableMixin;
23:
24: public const MIN = '00:00:00.000000';
25: public const MAX = '23:59:59.999999';
26:
27: public const DEFAULT_FORMAT = 'H:i:s';
28:
29: public const SECONDS_IN_A_DAY = 86400;
30:
31: /** @var float */
32: private $secondsSinceMidnight;
33:
34: /**
35: * @param string|int $time
36: */
37: public function __construct($time)
38: {
39: if (is_numeric($time)) {
40: Check::range($time, 0, self::SECONDS_IN_A_DAY);
41: $this->secondsSinceMidnight = $time;
42: } else {
43: try {
44: $dateTime = new \DateTime($time);
45: } catch (\Throwable $e) {
46: throw new \Dogma\Time\InvalidDateTimeException($time, $e);
47: }
48: $hours = (int) $dateTime->format('h');
49: $minutes = (int) $dateTime->format('i');
50: $seconds = (int) $dateTime->format('s');
51: $this->secondsSinceMidnight = $hours * 3600 + $minutes * 60 + $seconds;
52: }
53: }
54:
55: public static function createFromParts(int $hours, int $minutes, int $seconds = 0): self
56: {
57: Check::range($hours, 0, 23);
58: Check::range($minutes, 0, 59);
59: Check::range($seconds, 0, 59);
60:
61: return new static($hours * 3600 + $minutes * 60 + $seconds);
62: }
63:
64: public static function createFromSeconds(int $secondsSinceMidnight): self
65: {
66: return new static($secondsSinceMidnight);
67: }
68:
69: public static function createFromFormat(string $format, string $timeString): self
70: {
71: $dateTime = \DateTime::createFromFormat($format, $timeString);
72: if ($dateTime === false) {
73: throw new \Dogma\Time\InvalidDateTimeException('xxx');
74: }
75:
76: return new static($dateTime->format(self::DEFAULT_FORMAT));
77: }
78:
79: public function toDateTime(?Date $date = null, ?\DateTimeZone $timeZone = null): DateTime
80: {
81: return DateTime::createFromDateAndTime($date ?? new Date(), $this, $timeZone);
82: }
83:
84: public function format(string $format = self::DEFAULT_FORMAT, ?DateTimeFormatter $formatter = null): string
85: {
86: if ($formatter === null) {
87: $midnightTimestamp = mktime(0, 0, 0);
88:
89: return date($format, $midnightTimestamp + $this->secondsSinceMidnight);
90: } else {
91: return $formatter->format($this, $format);
92: }
93: }
94:
95: public function getSecondsSinceMidnight(): int
96: {
97: return $this->secondsSinceMidnight;
98: }
99:
100: public function getHours(): int
101: {
102: return (int) floor($this->secondsSinceMidnight / 3600);
103: }
104:
105: public function getMinutes(): int
106: {
107: return floor($this->secondsSinceMidnight / 60) % 60;
108: }
109:
110: public function getSeconds(): int
111: {
112: return $this->secondsSinceMidnight % 60;
113: }
114:
115: public function equals(Equalable $other): bool
116: {
117: $other instanceof self or Check::object($other, self::class);
118:
119: return $this->secondsSinceMidnight === $other->secondsSinceMidnight;
120: }
121:
122: public function compare(Comparable $other): int
123: {
124: $other instanceof self or Check::object($other, self::class);
125:
126: return $this->secondsSinceMidnight <=> $other->secondsSinceMidnight;
127: }
128:
129: /**
130: * @param \Dogma\Time\Time|string|int $since
131: * @param \Dogma\Time\Time|string|int $until
132: * @return bool
133: */
134: public function isBetween($since, $until): bool
135: {
136: if (!$since instanceof Time) {
137: $since = new static($since);
138: }
139: if (!$until instanceof Time) {
140: $until = new static($until);
141: }
142: $sinceSeconds = $since->secondsSinceMidnight;
143: $untilSeconds = $until->secondsSinceMidnight;
144: $thisSeconds = $this->secondsSinceMidnight;
145:
146: if ($sinceSeconds < $untilSeconds) {
147: return $thisSeconds >= $sinceSeconds && $thisSeconds <= $untilSeconds;
148: } elseif ($sinceSeconds > $untilSeconds) {
149: return $thisSeconds >= $sinceSeconds || $thisSeconds <= $untilSeconds;
150: } else {
151: return $thisSeconds === $sinceSeconds;
152: }
153: }
154:
155: /**
156: * @param \DateTimeInterface|\Dogma\Time\Time $time
157: * @param bool $absolute
158: * @return \DateInterval|bool
159: */
160: public function diff($time, bool $absolute = false)
161: {
162: Check::types($time, [\DateTimeInterface::class, self::class]);
163:
164: return (new \DateTime($this->format()))->diff(new \DateTime($time->format(self::DEFAULT_FORMAT)), $absolute);
165: }
166:
167: }
| 0 % | Tools\Amortizer.php |
<?php declare(strict_types = 1);
2:
3: namespace Dogma\Tools;
4:
5: class Amortizer
6: {
7: use \Dogma\StaticClassMixin;
8:
9: /** @var int[] */
10: private static $counters = [];
11:
12: public static function call(\Closure $closure, int $ratio = 1000): void
13: {
14: $key = spl_object_hash($closure);
15: if (isset(self::$counters[$key])) {
16: $counter = ++self::$counters[$key];
17: if (($counter % $ratio) === 0) {
18: $closure();
19: }
20: } else {
21: self::$counters[$key] = 1;
22: }
23: }
24:
25: public static function finish(\Closure $closure): void
26: {
27: $closure();
28: $key = spl_object_hash($closure);
29: unset(self::$counters[$key]);
30: }
31:
32: }
| 0 % | Transaction\exceptions\Exception.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: interface Exception
13: {
14:
15: }
| 0 % | Transaction\exceptions\FailedToCommitTransactionException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: class FailedToCommitTransactionException extends \Dogma\Exception implements \Dogma\Transaction\Exception
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var \Dogma\Transaction\Transaction */
17: private $transaction;
18:
19: public function __construct(Transaction $transaction, ?\Throwable $previous = null)
20: {
21: parent::__construct(sprintf('Transaction %s cannot be committed.', $transaction->getName()), $previous);
22:
23: $this->transaction = $transaction;
24: }
25:
26: }
| 0 % | Transaction\exceptions\FailedToRollbackTransactionException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: class FailedToRollbackTransactionException extends \Dogma\Exception implements \Dogma\Transaction\Exception
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var \Dogma\Transaction\Transaction */
17: private $transaction;
18:
19: public function __construct(Transaction $transaction, ?\Throwable $previous = null)
20: {
21: parent::__construct(sprintf('Transaction %s cannot be rolled back.', $transaction->getName()), $previous);
22:
23: $this->transaction = $transaction;
24: }
25:
26: }
| 0 % | Transaction\exceptions\FailedToStartTransactionException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: class FailedToStartTransactionException extends \Dogma\Exception implements \Dogma\Transaction\Exception
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var \Dogma\Transaction\Transaction */
17: private $transaction;
18:
19: public function __construct(Transaction $transaction, ?\Throwable $previous = null)
20: {
21: parent::__construct(sprintf('Cannot start transaction %s.', $transaction->getName()), $previous);
22:
23: $this->transaction = $transaction;
24: }
25:
26: }
| 0 % | Transaction\exceptions\TransactionDeadlockException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: class TransactionDeadlockException extends \Dogma\Exception implements \Dogma\Transaction\Exception
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var \Dogma\Transaction\Transaction */
17: private $transaction;
18:
19: public function __construct(Transaction $transaction, ?\Throwable $previous = null)
20: {
21: parent::__construct(sprintf('Transaction %s was deadlocked and cannot be persisted.', $transaction->getName()), $previous);
22:
23: $this->transaction = $transaction;
24: }
25:
26: }
| 0 % | Transaction\exceptions\TransactionRollbackException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: class TransactionRollbackException extends \Dogma\Exception implements \Dogma\Transaction\Exception
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var \Dogma\Transaction\Transaction */
17: private $transaction;
18:
19: public function __construct(Transaction $transaction, ?\Throwable $previous = null)
20: {
21: parent::__construct(sprintf('Rolling back transaction %s', $transaction->getName()), $previous);
22:
23: $this->transaction = $transaction;
24: }
25:
26: }
| 0 % | Transaction\exceptions\TransactionTimeoutException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: class TransactionTimeoutException extends \Dogma\Exception implements \Dogma\Transaction\Exception
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var \Dogma\Transaction\Transaction */
17: private $transaction;
18:
19: public function __construct(Transaction $transaction, ?\Throwable $previous = null)
20: {
21: parent::__construct(sprintf('Transaction %s timed out when persisting.', $transaction->getName()), $previous);
22:
23: $this->transaction = $transaction;
24: }
25:
26: }
| 100 % | Transaction\exceptions\VersioningNotInitializedException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: use Dogma\ExceptionValueFormatter;
13:
14: class VersioningNotInitializedException extends \Dogma\Exception
15: {
16:
17: public function __construct(VersionAware $listener, ?\Throwable $previous = null)
18: {
19: parent::__construct(sprintf('Versioning of %s has not been initialized yet.', ExceptionValueFormatter::format($listener)), $previous);
20: }
21:
22: }
| 0 % | Transaction\IsolationLevel.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: final class IsolationLevel extends \Dogma\Enum\StringEnum
13: {
14:
15: public const SERIALIZABLE = 'serializable';
16: public const READ_COMMITTED = 'read committed';
17: public const REPEATABLE_READ = 'repeatable read';
18: public const READ_UNCOMMITTED = 'read uncommitted';
19:
20: }
| 0 % | Transaction\Transaction.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: class Transaction implements \Dogma\NonIterable
13: {
14: use \Dogma\StrictBehaviorMixin;
15: use \Dogma\NonIterableMixin;
16:
17: /** @var int */
18: private $id;
19:
20: /** @var string */
21: private $name;
22:
23: /** @var \Dogma\Transaction\IsolationLevel|null */
24: private $isolationLevel;
25:
26: /** @var \Dogma\Transaction\TransactionManager */
27: private $manager;
28:
29: /**
30: * @param \Dogma\Transaction\TransactionManager $manager
31: * @param int $id
32: * @param string|null $name
33: * @param \DOgma\Transaction\IsolationLevel|null $isolationLevel
34: */
35: final public function __construct(
36: TransactionManager $manager,
37: int $id,
38: ?string $name = null,
39: ?IsolationLevel $isolationLevel = null
40: ) {
41: $this->manager = $manager;
42: $this->id = $id;
43: $this->name = $name;
44: $this->isolationLevel = $isolationLevel;
45: }
46:
47: public function getId(): int
48: {
49: return $this->id;
50: }
51:
52: public function getName(): string
53: {
54: return $this->name ?: ('tx' . $this->id);
55: }
56:
57: public function getIsolationLevel(): ?IsolationLevel
58: {
59: return $this->isolationLevel;
60: }
61:
62: public function commit(): void
63: {
64: ///
65: }
66:
67: public function rollback(): void
68: {
69: ///
70: }
71:
72: }
| 0 % | Transaction\TransactionAware.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: interface TransactionAware
13: {
14:
15: /**
16: * Returns true when supports nested transactions / savepoints
17: */
18: public function supportsNestedTransactions(): bool;
19:
20: /**
21: * @param \Dogma\Transaction\Transaction $transaction
22: * @throws \Dogma\Transaction\FailedToStartTransactionException
23: */
24: public function start(Transaction $transaction): void;
25:
26: /**
27: * @param \Dogma\Transaction\Transaction $transaction
28: * @throws \Dogma\Transaction\FailedToCommitTransactionException
29: */
30: public function commit(Transaction $transaction): void;
31:
32: /**
33: * @param \Dogma\Transaction\Transaction $transaction
34: * @throws \Dogma\Transaction\FailedToRollbackTransactionException
35: */
36: public function rollback(Transaction $transaction): void;
37:
38: }
| 56 % | Transaction\TransactionManager.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: use Dogma\Check;
13:
14: class TransactionManager
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var int */
19: private $versionId = 0;
20:
21: /** @var \Dogma\Transaction\Transaction[] */
22: private $transactions = [];
23:
24: /** @var \Dogma\Transaction\VersionAware[] */
25: private $versionListeners;
26:
27: /** @var \Dogma\Transaction\TransactionAware[] */
28: private $transactionListeners;
29:
30: /**
31: * @param \Dogma\Transaction\VersionAware[] $versionListeners
32: * @param \Dogma\Transaction\TransactionAware[] $transactionListeners
33: */
34: public function __construct(array $versionListeners = [], array $transactionListeners = [])
35: {
36: Check::itemsOfType($versionListeners, VersionAware::class);
37: Check::itemsOfType($transactionListeners, TransactionAware::class);
38:
39: $this->versionListeners = $versionListeners;
40: $this->transactionListeners = $transactionListeners;
41: }
42:
43: /**
44: * Version increments with each modification of persistent immutable entities
45: */
46: public function incrementVersion(): int
47: {
48: $this->versionId++;
49:
50: foreach ($this->versionListeners as $listener) {
51: $listener->incrementVersion($this->versionId);
52: }
53:
54: return $this->versionId;
55: }
56:
57: /**
58: * Version can be released only when all transactions are closed
59: * @param int $versionId
60: */
61: public function releaseVersion(int $versionId): void
62: {
63: ///
64:
65: foreach ($this->versionListeners as $listener) {
66: $listener->releaseToVersion($versionId);
67: }
68: }
69:
70: /**
71: * Version is rolled back after a transaction is rolled back or fails
72: * @param int $versionId
73: */
74: public function rollbackToVersion(int $versionId): void
75: {
76: ///
77:
78: foreach ($this->versionListeners as $listener) {
79: $listener->rollbackToVersion($versionId);
80: }
81: }
82:
83: public function start(?string $name = null, ?IsolationLevel $isolationLevel = null): Transaction
84: {
85: $this->versionId++;
86: $transaction = new Transaction($this, $this->versionId, $name, $isolationLevel);
87:
88: $this->transactions[$this->versionId] = $transaction;
89:
90: foreach ($this->transactionListeners as $listener) {
91: $listener->start($transaction);
92: }
93:
94: return $transaction;
95: }
96:
97: public function commit(Transaction $transaction): void
98: {
99: ///
100:
101: foreach ($this->transactionListeners as $listener) {
102: $listener->commit($transaction);
103: }
104: }
105:
106: public function rollback(Transaction $transaction): void
107: {
108: ///
109:
110: foreach ($this->transactionListeners as $listener) {
111: $listener->rollback($transaction);
112: }
113: }
114:
115: }
| 100 % | Transaction\VersionAware.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Transaction;
11:
12: interface VersionAware
13: {
14:
15: public function incrementVersion(int $versionId): void;
16:
17: public function releaseToVersion(int $versionId): void;
18:
19: public function rollbackToVersion(int $versionId): void;
20:
21: }
| 0 % | Web\Domain.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: // spell-check-ignore: iu
11:
12: namespace Dogma\Web;
13:
14: class Domain
15: {
16: use \Dogma\StrictBehaviorMixin;
17:
18: /** @var string */
19: private $name;
20:
21: public function __construct(string $name)
22: {
23: $this->name = $name;
24: }
25:
26: public static function validate(string $name): bool
27: {
28: return preg_match('~^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?[.])+[a-z]{2,6}$~iu', $name);
29: }
30:
31: public function getTld(): Tld
32: {
33: $parts = explode('.', $this->name);
34:
35: return Tld::get(end($parts));
36: }
37:
38: }
| 0 % | Web\exceptions\InvalidUrlException.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Web;
11:
12: class InvalidUrlException extends \Dogma\InvalidValueException
13: {
14:
15: public function __construct(string $value, ?\Throwable $previous = null)
16: {
17: \Dogma\Exception::__construct(sprintf('Invalid URL format: \'%s\'', $value), $previous);
18: }
19:
20: }
| 0 % | Web\Host.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Web;
11:
12: use Dogma\Check;
13: use Dogma\Str;
14:
15: class Host
16: {
17: use \Dogma\StrictBehaviorMixin;
18:
19: /** @var string */
20: private $host;
21:
22: /** @var int|null */
23: private $port;
24:
25: public function __construct(string $host, ?int $port = null)
26: {
27: if ($port === null && Str::contains($host, ':')) {
28: [$host, $port] = Str::splitByFirst($host, ':');
29: }
30: Check::nullableInt($port, 0, 65536);
31:
32: $this->host = $host;
33: $this->port = $port;
34: }
35:
36: public function getTld(): Tld
37: {
38: $parts = explode('.', $this->host);
39:
40: return Tld::get(end($parts));
41: }
42:
43: }
| 0 % | Web\Tld.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Web;
11:
12: use Dogma\Country\Country;
13:
14: final class Tld extends \Dogma\Enum\PartialStringEnum
15: {
16:
17: // common TLD
18: public const COM = 'com';
19: public const ORG = 'org';
20: public const NET = 'net';
21: public const INT = 'int';
22: public const EDU = 'edu';
23: public const GOV = 'gov';
24: public const MIL = 'mil';
25:
26: // country TLD
27: public const AC = 'ac';
28: public const AD = 'ad';
29: public const AE = 'ae';
30: public const AF = 'af';
31: public const AG = 'ag';
32: public const AI = 'ai';
33: public const AL = 'al';
34: public const AM = 'am';
35: public const AN = 'an';
36: public const AO = 'ao';
37: public const AQ = 'aq';
38: public const AR = 'ar';
39: public const AS_TLD = 'as';
40: public const AT = 'at';
41: public const AU = 'au';
42: public const AW = 'aw';
43: public const AX = 'ax';
44: public const AZ = 'az';
45: public const BA = 'ba';
46: public const BB = 'bb';
47: public const BD = 'bd';
48: public const BE = 'be';
49: public const BF = 'bf';
50: public const BG = 'bg';
51: public const BH = 'bh';
52: public const BI = 'bi';
53: public const BJ = 'bj';
54: public const BM = 'bm';
55: public const BN = 'bn';
56: public const BO = 'bo';
57: public const BQ = 'bq';
58: public const BR = 'br';
59: public const BS = 'bs';
60: public const BT = 'bt';
61: public const BV = 'bv';
62: public const BW = 'bw';
63: public const BY = 'by';
64: public const BZ = 'bz';
65: public const BZH = 'bzh';
66: public const CA = 'ca';
67: public const CC = 'cc';
68: public const CD = 'cd';
69: public const CF = 'cf';
70: public const CG = 'cg';
71: public const CH = 'ch';
72: public const CI = 'ci';
73: public const CK = 'ck';
74: public const CL = 'cl';
75: public const CM = 'cm';
76: public const CN = 'cn';
77: public const CO = 'co';
78: public const CR = 'cr';
79: public const CS = 'cs';
80: public const CU = 'cu';
81: public const CV = 'cv';
82: public const CW = 'cw';
83: public const CX = 'cx';
84: public const CY = 'cy';
85: public const CZ = 'cz';
86: public const DD = 'dd';
87: public const DE = 'de';
88: public const DJ = 'dj';
89: public const DK = 'dk';
90: public const DM = 'dm';
91: public const DO_TLD = 'do';
92: public const DZ = 'dz';
93: public const EC = 'ec';
94: public const EE = 'ee';
95: public const EG = 'eg';
96: public const EH = 'eh';
97: public const ER = 'er';
98: public const ES = 'es';
99: public const ET = 'et';
100: public const EU = 'eu';
101: public const FI = 'fi';
102: public const FJ = 'fj';
103: public const FK = 'fk';
104: public const FM = 'fm';
105: public const FO = 'fo';
106: public const FR = 'fr';
107: public const GA = 'ga';
108: public const GB = 'gb';
109: public const GD = 'gd';
110: public const GE = 'ge';
111: public const GF = 'gf';
112: public const GG = 'gg';
113: public const GH = 'gh';
114: public const GI = 'gi';
115: public const GL = 'gl';
116: public const GM = 'gm';
117: public const GN = 'gn';
118: public const GP = 'gp';
119: public const GQ = 'gq';
120: public const GR = 'gr';
121: public const GS = 'gs';
122: public const GT = 'gt';
123: public const GU = 'gu';
124: public const GW = 'gw';
125: public const GY = 'gy';
126: public const HK = 'hk';
127: public const HM = 'hm';
128: public const HN = 'hn';
129: public const HR = 'hr';
130: public const HT = 'ht';
131: public const HU = 'hu';
132: public const ID = 'id';
133: public const IE = 'ie';
134: public const IL = 'il';
135: public const IM = 'im';
136: public const IN = 'in';
137: public const IO = 'io';
138: public const IQ = 'iq';
139: public const IR = 'ir';
140: public const IS = 'is';
141: public const IT = 'it';
142: public const JE = 'je';
143: public const JM = 'jm';
144: public const JO = 'jo';
145: public const JP = 'jp';
146: public const KE = 'ke';
147: public const KG = 'kg';
148: public const KH = 'kh';
149: public const KI = 'ki';
150: public const KM = 'km';
151: public const KN = 'kn';
152: public const KP = 'kp';
153: public const KR = 'kr';
154: public const KRD = 'krd';
155: public const KW = 'kw';
156: public const KY = 'ky';
157: public const KZ = 'kz';
158: public const LA = 'la';
159: public const LB = 'lb';
160: public const LC = 'lc';
161: public const LI = 'li';
162: public const LK = 'lk';
163: public const LR = 'lr';
164: public const LS = 'ls';
165: public const LT = 'lt';
166: public const LU = 'lu';
167: public const LV = 'lv';
168: public const LY = 'ly';
169: public const MA = 'ma';
170: public const MC = 'mc';
171: public const MD = 'md';
172: public const ME = 'me';
173: public const MG = 'mg';
174: public const MH = 'mh';
175: public const MK = 'mk';
176: public const ML = 'ml';
177: public const MM = 'mm';
178: public const MN = 'mn';
179: public const MO = 'mo';
180: public const MP = 'mp';
181: public const MQ = 'mq';
182: public const MR = 'mr';
183: public const MS = 'ms';
184: public const MT = 'mt';
185: public const MU = 'mu';
186: public const MV = 'mv';
187: public const MW = 'mw';
188: public const MX = 'mx';
189: public const MY = 'my';
190: public const MZ = 'mz';
191: public const NA = 'na';
192: public const NC = 'nc';
193: public const NE = 'ne';
194: public const NF = 'nf';
195: public const NG = 'ng';
196: public const NI = 'ni';
197: public const NL = 'nl';
198: public const NO = 'no';
199: public const NP = 'np';
200: public const NR = 'nr';
201: public const NU = 'nu';
202: public const NZ = 'nz';
203: public const OM = 'om';
204: public const PA = 'pa';
205: public const PE = 'pe';
206: public const PF = 'pf';
207: public const PG = 'pg';
208: public const PH = 'ph';
209: public const PK = 'pk';
210: public const PL = 'pl';
211: public const PM = 'pm';
212: public const PN = 'pn';
213: public const PR = 'pr';
214: public const PS = 'ps';
215: public const PT = 'pt';
216: public const PW = 'pw';
217: public const PY = 'py';
218: public const QA = 'qa';
219: public const RE = 're';
220: public const RO = 'ro';
221: public const RS = 'rs';
222: public const RU = 'ru';
223: public const RW = 'rw';
224: public const SA = 'sa';
225: public const SB = 'sb';
226: public const SC = 'sc';
227: public const SD = 'sd';
228: public const SE = 'se';
229: public const SG = 'sg';
230: public const SH = 'sh';
231: public const SI = 'si';
232: public const SJ = 'sj';
233: public const SK = 'sk';
234: public const SL = 'sl';
235: public const SM = 'sm';
236: public const SN = 'sn';
237: public const SO = 'so';
238: public const SR = 'sr';
239: public const SS = 'ss';
240: public const ST = 'st';
241: public const SU = 'su';
242: public const SV = 'sv';
243: public const SX = 'sx';
244: public const SY = 'sy';
245: public const SZ = 'sz';
246: public const TC = 'tc';
247: public const TD = 'td';
248: public const TF = 'tf';
249: public const TG = 'tg';
250: public const TH = 'th';
251: public const TJ = 'tj';
252: public const TK = 'tk';
253: public const TL = 'tl';
254: public const TM = 'tm';
255: public const TN = 'tn';
256: public const TO = 'to';
257: public const TP = 'tp';
258: public const TR = 'tr';
259: public const TT = 'tt';
260: public const TV = 'tv';
261: public const TW = 'tw';
262: public const TZ = 'tz';
263: public const UA = 'ua';
264: public const UG = 'ug';
265: public const UK = 'uk';
266: public const US = 'us';
267: public const UY = 'uy';
268: public const UZ = 'uz';
269: public const VA = 'va';
270: public const VC = 'vc';
271: public const VE = 've';
272: public const VG = 'vg';
273: public const VI = 'vi';
274: public const VN = 'vn';
275: public const VU = 'vu';
276: public const WF = 'wf';
277: public const WS = 'ws';
278: public const YE = 'ye';
279: public const YT = 'yt';
280: public const YU = 'yu';
281: public const ZA = 'za';
282: public const ZM = 'zm';
283: public const ZR = 'zr';
284: public const ZW = 'zw';
285:
286: /** @var string[] */
287: private static $countryMap = [
288: self::AC => Country::SAINT_HELENA,
289: self::AD => Country::ANDORRA,
290: self::AE => Country::UNITED_ARAB_EMIRATES,
291: self::AF => Country::AFGHANISTAN,
292: self::AG => Country::ANTIGUA_AND_BARBUDA,
293: self::AI => Country::ANGUILLA,
294: self::AL => Country::ALBANIA,
295: self::AM => Country::ARMENIA,
296: self::AN => Country::NETHERLANDS_ANTILLES,
297: self::AO => Country::ANGOLA,
298: self::AQ => Country::ANTARCTICA,
299: self::AR => Country::ARGENTINA,
300: self::AS_TLD => Country::AMERICAN_SAMOA,
301: self::AT => Country::AUSTRIA,
302: self::AU => Country::AUSTRALIA,
303: self::AW => Country::ARUBA,
304: self::AX => Country::ALAND_ISLANDS,
305: self::AZ => Country::AZERBAIJAN,
306: self::BA => Country::BOSNIA_AND_HERZEGOVINA,
307: self::BB => Country::BARBADOS,
308: self::BD => Country::BANGLADESH,
309: self::BE => Country::BELGIUM,
310: self::BF => Country::BURKINA_FASO,
311: self::BG => Country::BULGARIA,
312: self::BH => Country::BAHRAIN,
313: self::BI => Country::BURUNDI,
314: self::BJ => Country::BENIN,
315: self::BM => Country::BERMUDA,
316: self::BN => Country::BRUNEI_DARUSSALAM,
317: self::BO => Country::BOLIVIA,
318: self::BQ => Country::NETHERLANDS,
319: self::BR => Country::BRAZIL,
320: self::BS => Country::BAHAMAS,
321: self::BT => Country::BHUTAN,
322: self::BV => Country::BOUVET_ISLAND,
323: self::BW => Country::BOTSWANA,
324: self::BY => Country::BELARUS,
325: self::BZ => Country::BELIZE,
326: self::BZH => Country::FRANCE,
327: self::CA => Country::CANADA,
328: self::CC => Country::COCOS_ISLANDS,
329: self::CD => Country::DEMOCRATIC_REPUBLIC_OF_THE_CONGO,
330: self::CF => Country::CENTRAL_AFRICAN_REPUBLIC,
331: self::CG => Country::CONGO,
332: self::CH => Country::SWITZERLAND,
333: self::CI => Country::COTE_D_IVOIRE,
334: self::CK => Country::COOK_ISLANDS,
335: self::CL => Country::CHILE,
336: self::CM => Country::CAMEROON,
337: self::CN => Country::CHINA,
338: self::CO => Country::COLOMBIA,
339: self::CR => Country::COSTA_RICA,
340: self::CU => Country::CUBA,
341: self::CV => Country::CAPE_VERDE,
342: self::CW => Country::NETHERLANDS,
343: self::CX => Country::CHRISTMAS_ISLAND,
344: self::CY => Country::CYPRUS,
345: self::CZ => Country::CZECHIA,
346: self::DD => Country::GERMANY,
347: self::DE => Country::GERMANY,
348: self::DJ => Country::DJIBOUTI,
349: self::DK => Country::DENMARK,
350: self::DM => Country::DOMINICA,
351: self::DO_TLD => Country::DOMINICAN_REPUBLIC,
352: self::DZ => Country::ALGERIA,
353: self::EC => Country::ECUADOR,
354: self::EE => Country::ESTONIA,
355: self::EG => Country::EGYPT,
356: self::EH => Country::WESTERN_SAHARA,
357: self::ER => Country::ERITREA,
358: self::ES => Country::SPAIN,
359: self::ET => Country::ETHIOPIA,
360: self::FI => Country::FINLAND,
361: self::FJ => Country::FIJI,
362: self::FK => Country::FALKLAND_ISLANDS,
363: self::FM => Country::MICRONESIA,
364: self::FO => Country::FAROE_ISLANDS,
365: self::FR => Country::FRANCE,
366: self::GA => Country::GABON,
367: self::GB => Country::UNITED_KINGDOM,
368: self::GD => Country::GRENADA,
369: self::GE => Country::GEORGIA,
370: self::GF => Country::FRENCH_GUIANA,
371: self::GG => Country::GUERNSEY,
372: self::GH => Country::GHANA,
373: self::GI => Country::GIBRALTAR,
374: self::GL => Country::GREENLAND,
375: self::GM => Country::GAMBIA,
376: self::GN => Country::GUINEA,
377: self::GP => Country::GUADELOUPE,
378: self::GQ => Country::EQUATORIAL_GUINEA,
379: self::GR => Country::GREECE,
380: self::GS => Country::SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH,
381: self::GT => Country::GUATEMALA,
382: self::GU => Country::GUAM,
383: self::GW => Country::GUINEA_BISSAU,
384: self::GY => Country::GUYANA,
385: self::HK => Country::HONG_KONG,
386: self::HM => Country::HEARD_ISLAND_AND_MCDONALD_ISLANDS,
387: self::HN => Country::HONDURAS,
388: self::HR => Country::CROATIA,
389: self::HT => Country::HAITI,
390: self::HU => Country::HUNGARY,
391: self::ID => Country::INDONESIA,
392: self::IE => Country::IRELAND,
393: self::IL => Country::ISRAEL,
394: self::IM => Country::ISLE_OF_MAN,
395: self::IN => Country::INDIA,
396: self::IO => Country::BRITISH_INDIAN_OCEAN_TERRITORY,
397: self::IQ => Country::IRAQ,
398: self::IR => Country::ISLAMIC_REPUBLIC_OF_IRAN,
399: self::IS => Country::ICELAND,
400: self::IT => Country::ITALY,
401: self::JE => Country::JERSEY,
402: self::JM => Country::JAMAICA,
403: self::JO => Country::JORDAN,
404: self::JP => Country::JAPAN,
405: self::KE => Country::KENYA,
406: self::KG => Country::KYRGYZSTAN,
407: self::KH => Country::CAMBODIA,
408: self::KI => Country::KIRIBATI,
409: self::KM => Country::COMOROS,
410: self::KN => Country::SAINT_KITTS_AND_NEVIS,
411: self::KP => Country::NORTH_KOREA,
412: self::KR => Country::SOUTH_KOREA,
413: self::KW => Country::KUWAIT,
414: self::KY => Country::CAYMAN_ISLANDS,
415: self::KZ => Country::KAZAKHSTAN,
416: self::LA => Country::LAOS,
417: self::LB => Country::LEBANON,
418: self::LC => Country::SAINT_LUCIA,
419: self::LI => Country::LIECHTENSTEIN,
420: self::LK => Country::SRI_LANKA,
421: self::LR => Country::LIBERIA,
422: self::LS => Country::LESOTHO,
423: self::LT => Country::LITHUANIA,
424: self::LU => Country::LUXEMBOURG,
425: self::LV => Country::LATVIA,
426: self::LY => Country::LIBYA,
427: self::MA => Country::MOROCCO,
428: self::MC => Country::MONACO,
429: self::MD => Country::MOLDOVA,
430: self::ME => Country::MONTENEGRO,
431: self::MG => Country::MADAGASCAR,
432: self::MH => Country::MARSHALL_ISLANDS,
433: self::MK => Country::MACEDONIA,
434: self::ML => Country::MALI,
435: self::MM => Country::MYANMAR,
436: self::MN => Country::MONGOLIA,
437: self::MO => Country::MACAO,
438: self::MP => Country::NORTHERN_MARIANA_ISLANDS,
439: self::MQ => Country::MARTINIQUE,
440: self::MR => Country::MAURITANIA,
441: self::MS => Country::MONTSERRAT,
442: self::MT => Country::MALTA,
443: self::MU => Country::MAURITIUS,
444: self::MV => Country::MALDIVES,
445: self::MW => Country::MALAWI,
446: self::MX => Country::MEXICO,
447: self::MY => Country::MALAYSIA,
448: self::MZ => Country::MOZAMBIQUE,
449: self::NA => Country::NAMIBIA,
450: self::NC => Country::NEW_CALEDONIA,
451: self::NE => Country::NIGER,
452: self::NF => Country::NORFOLK_ISLAND,
453: self::NG => Country::NIGERIA,
454: self::NI => Country::NICARAGUA,
455: self::NL => Country::NETHERLANDS,
456: self::NO => Country::NORWAY,
457: self::NP => Country::NEPAL,
458: self::NR => Country::NAURU,
459: self::NU => Country::NIUE,
460: self::NZ => Country::NEW_ZEALAND,
461: self::OM => Country::OMAN,
462: self::PA => Country::PANAMA,
463: self::PE => Country::PERU,
464: self::PF => Country::FRENCH_POLYNESIA,
465: self::PG => Country::PAPUA_NEW_GUINEA,
466: self::PH => Country::PHILIPPINES,
467: self::PK => Country::PAKISTAN,
468: self::PL => Country::POLAND,
469: self::PM => Country::SAINT_PIERRE_AND_MIQUELON,
470: self::PN => Country::PITCAIRN,
471: self::PR => Country::PUERTO_RICO,
472: self::PS => Country::PALESTINE,
473: self::PT => Country::PORTUGAL,
474: self::PW => Country::PALAU,
475: self::PY => Country::PARAGUAY,
476: self::QA => Country::QATAR,
477: self::RE => Country::REUNION,
478: self::RO => Country::ROMANIA,
479: self::RS => Country::SERBIA,
480: self::RU => Country::RUSSIA,
481: self::RW => Country::RWANDA,
482: self::SA => Country::SAUDI_ARABIA,
483: self::SB => Country::SOLOMON_ISLANDS,
484: self::SC => Country::SEYCHELLES,
485: self::SD => Country::SUDAN,
486: self::SE => Country::SWEDEN,
487: self::SG => Country::SINGAPORE,
488: self::SH => Country::SAINT_HELENA,
489: self::SI => Country::SLOVENIA,
490: self::SJ => Country::SVALBARD_AND_JAN_MAYEN,
491: self::SK => Country::SLOVAKIA,
492: self::SL => Country::SIERRA_LEONE,
493: self::SM => Country::SAN_MARINO,
494: self::SN => Country::SENEGAL,
495: self::SO => Country::SOMALIA,
496: self::SR => Country::SURINAME,
497: self::SS => Country::SOUTH_SUDAN,
498: self::ST => Country::SAO_TOME_AND_PRINCIPE,
499: self::SV => Country::EL_SALVADOR,
500: self::SX => Country::NETHERLANDS,
501: self::SY => Country::SYRIA,
502: self::SZ => Country::SWAZILAND,
503: self::TC => Country::TURKS_AND_CAICOS_ISLANDS,
504: self::TD => Country::CHAD,
505: self::TF => Country::FRENCH_SOUTHERN_TERRITORIES,
506: self::TG => Country::TOGO,
507: self::TH => Country::THAILAND,
508: self::TJ => Country::TAJIKISTAN,
509: self::TK => Country::TOKELAU,
510: self::TL => Country::TIMOR_LESTE,
511: self::TM => Country::TURKMENISTAN,
512: self::TN => Country::TUNISIA,
513: self::TO => Country::TONGA,
514: self::TP => Country::TIMOR_LESTE,
515: self::TR => Country::TURKEY,
516: self::TT => Country::TRINIDAD_AND_TOBAGO,
517: self::TV => Country::TUVALU,
518: self::TW => Country::TAIWAN,
519: self::TZ => Country::TANZANIA,
520: self::UA => Country::UKRAINE,
521: self::UG => Country::UGANDA,
522: self::UK => Country::UNITED_KINGDOM,
523: self::US => Country::UNITED_STATES,
524: self::UY => Country::URUGUAY,
525: self::UZ => Country::UZBEKISTAN,
526: self::VA => Country::VATICAN,
527: self::VC => Country::SAINT_VINCENT_AND_THE_GRENADINES,
528: self::VE => Country::VENEZUELA,
529: self::VG => Country::VIRGIN_ISLANDS_BRITISH,
530: self::VI => Country::VIRGIN_ISLANDS_US,
531: self::VN => Country::VIETNAM,
532: self::VU => Country::VANUATU,
533: self::WF => Country::WALLIS_AND_FUTUNA,
534: self::WS => Country::SAMOA,
535: self::YE => Country::YEMEN,
536: self::YT => Country::MAYOTTE,
537: self::ZA => Country::SOUTH_AFRICA,
538: self::ZM => Country::ZAMBIA,
539: self::ZR => Country::DEMOCRATIC_REPUBLIC_OF_THE_CONGO,
540: self::ZW => Country::ZIMBABWE,
541: ];
542:
543: public function isCountryTld(): bool
544: {
545: return strlen($this->getValue()) === 2 || $this->equals(self::BZH);
546: }
547:
548: public function getCountry(): ?Country
549: {
550: $value = $this->getValue();
551: if (isset(self::$countryMap[$value])) {
552: return Country::get(self::$countryMap[$value]);
553: }
554: return null;
555: }
556:
557: public static function getByCountry(Country $country): self
558: {
559: return self::get(array_search($country->getValue(), self::$countryMap));
560: }
561:
562: public static function getValueRegexp(): string
563: {
564: return '^([a-z]{2,}|xn--[0-9a-z]{4,})$';
565: }
566:
567: }
| 0 % | Web\UriScheme.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Web;
11:
12: class UriScheme extends \Dogma\Enum\PartialStringEnum
13: {
14:
15: // IETF
16: public const AAA = 'aaa';
17: public const AAAS = 'aaas';
18: public const ABOUT = 'about';
19: public const ACAP = 'acap';
20: public const ACCT = 'acct';
21: public const ACR = 'acr';
22: public const ADIUMXTRA = 'adiumxtra';
23: public const AFP = 'afp';
24: public const AFS = 'afs';
25: public const AIM = 'aim';
26: public const APPDATA = 'appdata';
27: public const APT = 'apt';
28: public const ATTACHMENT = 'attachment';
29: public const AW = 'aw';
30: public const BARION = 'barion';
31: public const BESHARE = 'beshare';
32: public const BITCOIN = 'bitcoin';
33: public const BLOB = 'blob';
34: public const BOLO = 'bolo';
35: public const BROWSEREXT = 'browserext';
36: public const CALLTO = 'callto';
37: public const CAP = 'cap';
38: public const CHROME = 'chrome';
39: public const CHROME_EXTENSION = 'chrome-extension';
40: public const CID = 'cid';
41: public const COAP = 'coap';
42: public const COAPS = 'coaps';
43: public const COM_EVENTBRITE_ATTENDEE = 'com-eventbrite-attendee';
44: public const CONTENT = 'content';
45: public const CRID = 'crid';
46: public const CVS = 'cvs';
47: public const DATA = 'data';
48: public const DAV = 'dav';
49: public const DICT = 'dict';
50: public const DIS = 'dis';
51: public const DLNA_PLAYCONTAINER = 'dlna-playcontainer';
52: public const DLNA_PLAYSINGLE = 'dlna-playsingle';
53: public const DNS = 'dns';
54: public const DNTP = 'dntp';
55: public const DTN = 'dtn';
56: public const DVB = 'dvb';
57: public const ED2K = 'ed2k';
58: public const EXAMPLE = 'example';
59: public const FACETIME = 'facetime';
60: public const FAX = 'fax';
61: public const FEED = 'feed';
62: public const FEEDREADY = 'feedready';
63: public const FILE = 'file';
64: public const FILESYSTEM = 'filesystem';
65: public const FINGER = 'finger';
66: public const FISH = 'fish';
67: public const FTP = 'ftp';
68: public const GEO = 'geo';
69: public const GG = 'gg';
70: public const GIT = 'git';
71: public const GIZMOPROJECT = 'gizmoproject';
72: public const GO = 'go';
73: public const GOPHER = 'gopher';
74: public const GTALK = 'gtalk';
75: public const H323 = 'h323';
76: public const HAM = 'ham';
77: public const HCP = 'hcp';
78: public const HTTP = 'http';
79: public const HTTPS = 'https';
80: public const IAX = 'iax';
81: public const ICAP = 'icap';
82: public const ICON = 'icon';
83: public const IM = 'im';
84: public const IMAP = 'imap';
85: public const INFO = 'info';
86: public const IOTDISCO = 'iotdisco';
87: public const IPN = 'ipn';
88: public const IPP = 'ipp';
89: public const IPPS = 'ipps';
90: public const IRC = 'irc';
91: public const IRC6 = 'irc6';
92: public const IRCS = 'ircs';
93: public const IRIS = 'iris';
94: public const IRIS_BEEP = 'iris.beep';
95: public const IRIS_LWZ = 'iris.lwz';
96: public const IRIS_XPC = 'iris.xpc';
97: public const IRIS_XPCS = 'iris.xpcs';
98: public const ISOSTORE = 'isostore';
99: public const ITMS = 'itms';
100: public const JABBER = 'jabber';
101: public const JAR = 'jar';
102: public const JMS = 'jms';
103: public const KEYPARC = 'keyparc';
104: public const LASTFM = 'lastfm';
105: public const LDAP = 'ldap';
106: public const LDAPS = 'ldaps';
107: public const LVLT = 'lvlt';
108: public const MAGNET = 'magnet';
109: public const MAILSERVER = 'mailserver';
110: public const MAILTO = 'mailto';
111: public const MAPS = 'maps';
112: public const MARKET = 'market';
113: public const MESSAGE = 'message';
114: public const MID = 'mid';
115: public const MMS = 'mms';
116: public const MODEM = 'modem';
117: public const MOZ = 'moz';
118: public const MS_ACCESS = 'ms-access';
119: public const MS_BROWSER_EXTENSION = 'ms-browser-extension';
120: public const MS_DRIVE_TO = 'ms-drive-to';
121: public const MS_ENROLLMENT = 'ms-enrollment';
122: public const MS_EXCEL = 'ms-excel';
123: public const MS_GAMEBARSERVICES = 'ms-gamebarservices';
124: public const MS_GETOFFICE = 'ms-getoffice';
125: public const MS_HELP = 'ms-help';
126: public const MS_INFOPATH = 'ms-infopath';
127: public const MS_MEDIA_STREAM_ID = 'ms-media-stream-id';
128: public const MS_PROJECT = 'ms-project';
129: public const MS_POWERPOINT = 'ms-powerpoint';
130: public const MS_PUBLISHER = 'ms-publisher';
131: public const MS_SEARCH_REPAIR = 'ms-search-repair';
132: public const MS_SECONDARY_SCREEN_CONTROLLER = 'ms-secondary-screen-controller';
133: public const MS_SECONDARY_SCREEN_SETUP = 'ms-secondary-screen-setup';
134: public const MS_SETTINGS = 'ms-settings';
135: public const MS_SETTINGS_AIRPLANEMODE = 'ms-settings-airplanemode';
136: public const MS_SETTINGS_BLUETOOTH = 'ms-settings-bluetooth';
137: public const MS_SETTINGS_CAMERA = 'ms-settings-camera';
138: public const MS_SETTINGS_CELLULAR = 'ms-settings-cellular';
139: public const MS_SETTINGS_CLOUDSTORAGE = 'ms-settings-cloudstorage';
140: public const MS_SETTINGS_CONNECTABLEDEVICES = 'ms-settings-connectabledevices';
141: public const MS_SETTINGS_DISPLAYS_TOPOLOGY = 'ms-settings-displays-topology';
142: public const MS_SETTINGS_EMAILANDACCOUNTS = 'ms-settings-emailandaccounts';
143: public const MS_SETTINGS_LANGUAGE = 'ms-settings-language';
144: public const MS_SETTINGS_LOCATION = 'ms-settings-location';
145: public const MS_SETTINGS_LOCK = 'ms-settings-lock';
146: public const MS_SETTINGS_NFCTRANSACTIONS = 'ms-settings-nfctransactions';
147: public const MS_SETTINGS_NOTIFICATIONS = 'ms-settings-notifications';
148: public const MS_SETTINGS_POWER = 'ms-settings-power';
149: public const MS_SETTINGS_PRIVACY = 'ms-settings-privacy';
150: public const MS_SETTINGS_PROXIMITY = 'ms-settings-proximity';
151: public const MS_SETTINGS_SCREENROTATION = 'ms-settings-screenrotation';
152: public const MS_SETTINGS_WIFI = 'ms-settings-wifi';
153: public const MS_SETTINGS_WORKPLACE = 'ms-settings-workplace';
154: public const MS_SPD = 'ms-spd';
155: public const MS_STTOVERLAY = 'ms-sttoverlay';
156: public const MS_TRANSIT_TO = 'ms-transit-to';
157: public const MS_VIRTUALTOUCHPAD = 'ms-virtualtouchpad';
158: public const MS_VISIO = 'ms-visio';
159: public const MS_WALK_TO = 'ms-walk-to';
160: public const MS_WORD = 'ms-word';
161: public const MSNIM = 'msnim';
162: public const MSRP = 'msrp';
163: public const MSRPS = 'msrps';
164: public const MTQP = 'mtqp';
165: public const MUMBLE = 'mumble';
166: public const MUPDATE = 'mupdate';
167: public const MVN = 'mvn';
168: public const NEWS = 'news';
169: public const NFS = 'nfs';
170: public const NI = 'ni';
171: public const NIH = 'nih';
172: public const NNTP = 'nntp';
173: public const NOTES = 'notes';
174: public const OCF = 'ocf';
175: public const OID = 'oid';
176: public const OPAQUELOCKTOKEN = 'opaquelocktoken';
177: public const PACK = 'pack';
178: public const PALM = 'palm';
179: public const PAPARAZZI = 'paparazzi';
180: public const PKCS11 = 'pkcs11';
181: public const PLATFORM = 'platform';
182: public const POP = 'pop';
183: public const PRES = 'pres';
184: public const PROSPERO = 'prospero';
185: public const PROXY = 'proxy';
186: public const PWID = 'pwid';
187: public const PSYC = 'psyc';
188: public const QB = 'qb';
189: public const QUERY = 'query';
190: public const REDIS = 'redis';
191: public const REDISS = 'rediss';
192: public const RELOAD = 'reload';
193: public const RES = 'res';
194: public const RESOURCE = 'resource';
195: public const RMI = 'rmi';
196: public const RSYNC = 'rsync';
197: public const RTMFP = 'rtmfp';
198: public const RTMP = 'rtmp';
199: public const RTSP = 'rtsp';
200: public const RTSPS = 'rtsps';
201: public const RTSPU = 'rtspu';
202: public const SECONDLIFE = 'secondlife';
203: public const SERVICE = 'service';
204: public const SESSION = 'session';
205: public const SFTP = 'sftp';
206: public const SGN = 'sgn';
207: public const SHTTP = 'shttp';
208: public const SIEVE = 'sieve';
209: public const SIP = 'sip';
210: public const SIPS = 'sips';
211: public const SKYPE = 'skype';
212: public const SMB = 'smb';
213: public const SMS = 'sms';
214: public const SMTP = 'smtp';
215: public const SNEWS = 'snews';
216: public const SNMP = 'snmp';
217: public const SOAP_BEEP = 'soap.beep';
218: public const SOAP_BEEPS = 'soap.beeps';
219: public const SOLDAT = 'soldat';
220: public const SPOTIFY = 'spotify';
221: public const SSH = 'ssh';
222: public const STEAM = 'steam';
223: public const STUN = 'stun';
224: public const STUNS = 'stuns';
225: public const SUBMIT = 'submit';
226: public const SVN = 'svn';
227: public const TAG = 'tag';
228: public const TEAMSPEAK = 'teamspeak';
229: public const TEL = 'tel';
230: public const TELIAEID = 'teliaeid';
231: public const TELNET = 'telnet';
232: public const TFTP = 'tftp';
233: public const THINGS = 'things';
234: public const THISMESSAGE = 'thismessage';
235: public const TIP = 'tip';
236: public const TN3270 = 'tn3270';
237: public const TOOL = 'tool';
238: public const TURN = 'turn';
239: public const TURNS = 'turns';
240: public const TV = 'tv';
241: public const UDP = 'udp';
242: public const UNREAL = 'unreal';
243: public const URN = 'urn';
244: public const UT2004 = 'ut2004';
245: public const V_EVENT = 'v-event';
246: public const VEMMI = 'vemmi';
247: public const VENTRILO = 'ventrilo';
248: public const VIDEOTEX = 'videotex';
249: public const VNC = 'vnc';
250: public const VIEW_SOURCE = 'view-source';
251: public const WAIS = 'wais';
252: public const WEBCAL = 'webcal';
253: public const WPID = 'wpid';
254: public const WS = 'ws';
255: public const WSS = 'wss';
256: public const WTAI = 'wtai';
257: public const WYCIWYG = 'wyciwyg';
258: public const XCON = 'xcon';
259: public const XCON_USERID = 'xcon-userid';
260: public const XFIRE = 'xfire';
261: public const XMLRPC_BEEP = 'xmlrpc.beep';
262: public const XMLRPC_BEEPS = 'xmlrpc.beeps';
263: public const XMPP = 'xmpp';
264: public const XRI = 'xri';
265: public const YMSGR = 'ymsgr';
266: public const Z39_50 = 'z39.50';
267: public const Z39_50R = 'z39.50r';
268: public const Z39_50S = 'z39.50s';
269:
270: }
| 0 % | Web\Url.php |
<?php declare(strict_types = 1);
2: /**
3: * This file is part of the Dogma library (https://github.com/paranoiq/dogma)
4: *
5: * Copyright (c) 2012 Vlasta Neubauer (@paranoiq)
6: *
7: * For the full copyright and license information read the file 'license.md', distributed with this source code
8: */
9:
10: namespace Dogma\Web;
11:
12: class Url
13: {
14: use \Dogma\StrictBehaviorMixin;
15:
16: /** @var \Nette\Http\Url */
17: private $url;
18:
19: public function __construct(string $url)
20: {
21: try {
22: $this->url = new \Nette\Http\Url($url);
23: } catch (\Nette\InvalidArgumentException $e) {
24: throw new \Dogma\Web\InvalidUrlException($url);
25: }
26: }
27:
28: public function getScheme(): UriScheme
29: {
30: return UriScheme::get($this->url->getScheme());
31: }
32:
33: /**
34: * @return string|null
35: */
36: public function getUser(): string
37: {
38: return $this->url->getUser();
39: }
40:
41: /**
42: * @return string|null
43: */
44: public function getPassword(): string
45: {
46: return $this->url->getPassword();
47: }
48:
49: public function getHost(): Domain
50: {
51: return new Domain($this->url->getHost());
52: }
53:
54: public function getDomain(): Domain
55: {
56: return new Domain($this->url->getHost());
57: }
58:
59: public function getTld(): Tld
60: {
61: return $this->getDomain()->getTld();
62: }
63:
64: public function getPort(): ?int
65: {
66: return $this->url->getPort();
67: }
68:
69: public function getPath(): string
70: {
71: return $this->url->getPath();
72: }
73:
74: public function getQuery(): string
75: {
76: return $this->url->getQuery();
77: }
78:
79: public function getFragment(): string
80: {
81: return $this->getFragment();
82: }
83:
84: }